|
Joined: Jan 2014
Posts: 107
Vogon poet
|
OP
Vogon poet
Joined: Jan 2014
Posts: 107 |
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.
|
|
|
|
Joined: Dec 2008
Posts: 1,483
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,483 |
You must use 'ISOP' if statement on your event. Help details: /help isop i will give you some examples: e.g:
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 }
}
|
|
|
|
Joined: Jan 2014
Posts: 107
Vogon poet
|
OP
Vogon poet
Joined: Jan 2014
Posts: 107 |
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.
|
|
|
|
Joined: Dec 2008
Posts: 1,483
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,483 |
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.
ON *!:TEXT:!*:#: {
var %rn = $read(owners.txt,ntw,$nick)
if (%rn) && (%rn !== $nick) { halt }
}
Example of the 'owners.txt' nick1 nick2 nick3 ...
|
|
|
|
Joined: Dec 2013
Posts: 771
Hoopy frood
|
Hoopy frood
Joined: Dec 2013
Posts: 771 |
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 and from an ini file. But what I believe Majeye was looking for was a simple if statement like: if ($nick != username) return and I suggest you read the help files regarding these matters. /help if then else /help $nick etc
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
Do owners have a different mode prefix?
E.g. some networks use either a '.' or a '~' to signify owners.
|
|
|
|
Joined: Dec 2013
Posts: 771
Hoopy frood
|
Hoopy frood
Joined: Dec 2013
Posts: 771 |
Nope, they do not. They're simply labeled and treated as ops as well from the server.
|
|
|
|
Joined: Jan 2014
Posts: 107
Vogon poet
|
OP
Vogon poet
Joined: Jan 2014
Posts: 107 |
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 and from an ini file. But what I believe Majeye was looking for was a simple if statement like: 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? 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: 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.
|
|
|
|
Joined: Jan 2014
Posts: 107
Vogon poet
|
OP
Vogon poet
Joined: Jan 2014
Posts: 107 |
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): 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. }
}
|
|
|
|
Joined: Dec 2008
Posts: 1,483
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,483 |
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): 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:
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). }
}
|
|
|
|
|