mIRC Home    About    Download    Register    News    Help

Print Thread
Need help with "channel owner" only script #248615
13/10/14 09:47 PM
13/10/14 09:47 PM
Joined: Jan 2014
Posts: 101
MN, USA
M
Majeye Offline OP
Vogon poet
Majeye  Offline OP
Vogon poet
M

Joined: Jan 2014
Posts: 101
MN, USA
Greetings, everyone.

I really dislike making new threads when I know this exists already, just having a difficult time finding the thread(s) with this scripting already in them.

I am having a hard time trying to find the script that only allows channel-owners only to make use of commands.

Any help appreciated.

Re: Need help with "channel owner" only script [Re: Majeye] #248616
13/10/14 09:55 PM
13/10/14 09:55 PM
Joined: Dec 2008
Posts: 1,511
Greece
westor Offline
Hoopy frood
westor  Offline
Hoopy frood

Joined: Dec 2008
Posts: 1,511
Greece
You must use 'ISOP' if statement on your event.

Help details: /help isop

i will give you some examples:

e.g:

Code:
ON !*:TEXT:!COMMAND:#MY_CHANNEL: {
  if ($nick isop $chan) { echo -a OK $nick is an channel operator }
  elseif ($nick !isop $chan) { echo -a ERROR $nick is NOT an channel operator }
}



Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-
Re: Need help with "channel owner" only script [Re: westor] #248618
13/10/14 11:07 PM
13/10/14 11:07 PM
Joined: Jan 2014
Posts: 101
MN, USA
M
Majeye Offline OP
Vogon poet
Majeye  Offline OP
Vogon poet
M

Joined: Jan 2014
Posts: 101
MN, USA
I thought there was a way to make it so that only the channel owner could do it...

I don't remember the actual scripting off hand (which is the purpose of this thread), but isop makes it so all channel operators (moderators) can use the specified command, instead of just the channel owner (or just 1 specified person)

I do remember you had to put the actual persons username in the script somewhere, just don't remember what the script looked like.

all I remember was something like ( username | anotherusername) or something to that effect.

Last edited by Majeye; 13/10/14 11:09 PM.
Re: Need help with "channel owner" only script [Re: Majeye] #248619
13/10/14 11:14 PM
13/10/14 11:14 PM
Joined: Dec 2008
Posts: 1,511
Greece
westor Offline
Hoopy frood
westor  Offline
Hoopy frood

Joined: Dec 2008
Posts: 1,511
Greece
Ah ok if you want this there is an other way, you can create a file on your system e.g: owners.txt and add there the nicks that you want and use this code:

This code stop from any command if the user is NOT on the 'owners.txt' file.

Code:
ON *!:TEXT:!*:#: {
  var %rn = $read(owners.txt,ntw,$nick)
  if (%rn) && (%rn !== $nick) { halt }
}


Example of the 'owners.txt'

nick1
nick2
nick3
...


Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-
Re: Need help with "channel owner" only script [Re: westor] #248628
14/10/14 07:24 AM
14/10/14 07:24 AM
Joined: Dec 2013
Posts: 779
Sweden
N
Nillen Offline
Hoopy frood
Nillen  Offline
Hoopy frood
N

Joined: Dec 2013
Posts: 779
Sweden
An extension to this, owners are always the same $nick as the #channel name on twitch. Example (nillens and #nillens) So for my own script where I use userlevels I have a check for
Code:
$nick == $mid(#,2)
and from an ini file.

But what I believe Majeye was looking for was a simple if statement like:
Code:
if ($nick != username) return
and I suggest you read the help files regarding these matters.
/help if then else
/help $nick
etc


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Need help with "channel owner" only script [Re: Nillen] #248644
14/10/14 07:16 PM
14/10/14 07:16 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
hixxy  Offline
Hoopy frood
H

Joined: Sep 2005
Posts: 2,876
Do owners have a different mode prefix?

E.g. some networks use either a '.' or a '~' to signify owners.

Re: Need help with "channel owner" only script [Re: hixxy] #248645
14/10/14 07:32 PM
14/10/14 07:32 PM
Joined: Dec 2013
Posts: 779
Sweden
N
Nillen Offline
Hoopy frood
Nillen  Offline
Hoopy frood
N

Joined: Dec 2013
Posts: 779
Sweden
Nope, they do not. They're simply labeled and treated as ops as well from the server.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Need help with "channel owner" only script [Re: Nillen] #248648
14/10/14 10:01 PM
14/10/14 10:01 PM
Joined: Jan 2014
Posts: 101
MN, USA
M
Majeye Offline OP
Vogon poet
Majeye  Offline OP
Vogon poet
M

Joined: Jan 2014
Posts: 101
MN, USA
Originally Posted By: Nillen
An extension to this, owners are always the same $nick as the #channel name on twitch. Example (nillens and #nillens) So for my own script where I use userlevels I have a check for
Code:
$nick == $mid(#,2)
and from an ini file.

But what I believe Majeye was looking for was a simple if statement like:
Code:
if ($nick != username) return
and I suggest you read the help files regarding these matters.
/help if then else
/help $nick
etc


That is exactly what I was seeking.

Unfortunately i'm still having difficulty getting it to work properly.. mind looking over the following code and pointing out where I went wrong?

Code:
on $*:text:/!karma (add|remove)/Si:#thebluemuzzy:{
  if ( $nick == thebluemuzzy ) { return } {
    if ($0 < 3) { msg # Insufficient parameters: Use !karma <add|remove> <user> [number] | return }
    writeini -n Karma.ini $+(#,.,$3) Points $calc($readini(Karma.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    { msg $chan $3 now has $readini(Karma.ini,$+(#,.,$3),Points) total karma. }
  }
  else { msg $chan This command is only available to TheBlueMuzzy. }
}


Nevermind.. fixed it myself with:

Code:
on $*:text:/!karma (add|remove)/Si:#thebluemuzzy:{
  if ( $nick == thebluemuzzy ) { 
    if ($0 < 3) { msg # Insufficient parameters: Use !karma <add|remove> <user> [number] | return }
    writeini -n Karma.ini $+(#,.,$3) Points $calc($readini(Karma.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    { msg $chan $3 now has $readini(Karma.ini,$+(#,.,$3),Points) total karma. }
  }
  else { msg $chan This command is only available to TheBlueMuzzy. }
}

Last edited by Majeye; 14/10/14 10:31 PM.
Re: Need help with "channel owner" only script [Re: Majeye] #248649
14/10/14 10:33 PM
14/10/14 10:33 PM
Joined: Jan 2014
Posts: 101
MN, USA
M
Majeye Offline OP
Vogon poet
Majeye  Offline OP
Vogon poet
M

Joined: Jan 2014
Posts: 101
MN, USA
Now that I have that fixed.. I'm curious as to how a 2nd name can be added to the command?

I thought it was something like this (but doesn't seem to work):

Code:
on $*:text:/!karma (add|remove)/Si:#thebluemuzzy:{
  if ( $nick == thebluemuzzy | $nick == majeye ) { 
    if ($0 < 3) { msg # Insufficient parameters: Use !karma <add|remove> <user> [number] | return }
    writeini -n Karma.ini $+(#,.,$3) Points $calc($readini(Karma.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    { msg $chan $3 now has $readini(Karma.ini,$+(#,.,$3),Points) total karma. }
  }
  else { msg $chan This command is only available to TheBlueMuzzy & Majeye. }
}

Re: Need help with "channel owner" only script [Re: Majeye] #248650
14/10/14 11:00 PM
14/10/14 11:00 PM
Joined: Dec 2008
Posts: 1,511
Greece
westor Offline
Hoopy frood
westor  Offline
Hoopy frood

Joined: Dec 2008
Posts: 1,511
Greece
Originally Posted By: Majeye
Now that I have that fixed.. I'm curious as to how a 2nd name can be added to the command?

I thought it was something like this (but doesn't seem to work):

Code:
on $*:text:/!karma (add|remove)/Si:#thebluemuzzy:{
  if ( $nick == thebluemuzzy | $nick == majeye ) { 
    if ($0 < 3) { msg # Insufficient parameters: Use !karma <add|remove> <user> [number] | return }
    writeini -n Karma.ini $+(#,.,$3) Points $calc($readini(Karma.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    { msg $chan $3 now has $readini(Karma.ini,$+(#,.,$3),Points) total karma. }
  }
  else { msg $chan This command is only available to TheBlueMuzzy & Majeye. }
}


Try use this code:

Code:
on $*:text:/!karma (add|remove)/Si:#thebluemuzzy: {
  var %nicks = thebluemuzzy majeye
  if ($istok(%nicks,$nick,32)) { 
    if ($0 < 3) { msg # Insufficient parameters: Use !karma <add|remove> <user> [number] | return }
    writeini -n Karma.ini $+(#,.,$3) Points $calc($readini(Karma.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    { msg $chan $3 now has $readini(Karma.ini,$+(#,.,$3),Points) total karma. }
  }
  else { msg $chan This command is only available to %nicks nickname(s). }
}


Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-