|
Joined: Aug 2004
Posts: 14
Pikka bird
|
OP
Pikka bird
Joined: Aug 2004
Posts: 14 |
I'm looking for a script that sets mode +o on users that do a certain command (The command I was thinking of was !op).
Thanks in advance.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
on @*:TEXT:!op:#yourchannel: if $nick !isop # { mode # +o $nick }
Change #yourchannel to the channel you want this to trigger to.
Put it at # if you want it to trigger on all channels.
Use commas as delimiter to seperate multiple channels like #chan1,#chan2,#chan3
You can also use a variable fex %opchans #chan1,#chan2,#chan3 and specify that variable then like this:
on @*:TEXT:!op:%opchans: if $nick !isop # { mode # +o $nick }
Greets
Gone.
|
|
|
|
Joined: Aug 2004
Posts: 14
Pikka bird
|
OP
Pikka bird
Joined: Aug 2004
Posts: 14 |
Could I have the code for +v as well please (The command being !voice)?
Thanks.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Ok, using /auser <level> <nick> wouldn't be very safe to be honest, anyone who changes their nickname to a user in the user list will have access to the !op command. So we'll use /guser which specifically adds <level> <nick> <address type> /guser op Andy 2 Would look something like: - * Added Andy[bed] (*!*@=Tydncb76-549-306-080.range81-155.btcentralplus.com) to user list -
Now, the /guser command will only work if that user is on the server. We've handled our nicknames, lets get to the event handling.
On @*:Text:*:[color:red]#channel[/color]: {
if ($ulist($ial($nick))) {
if ($left($1,1) == $chr(33)) {
if ($gettok($1,1,33) == op) { mode $chan +o $nick }
if ($gettok($1,1,33) == deop) { mode $chan -o $nick }
if ($gettok($1,1,33) == voice) { mode $chan +v $nick }
if ($gettok($1,1,33) == devoice) { mode $chan -v $nick }
}
}
}
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
on @*:TEXT:!voice:#yourchannel: if $nick !isvoice # { mode # +v $nick }
Gone.
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Have two tips for you Andy: - You can either store the command in a var, or tokenize it so that $1 is filled with the command. Makes your code quite shorter, and easier to read.
tokenize 33 !op --> $1 is now filled with the actual command: op
if $1 == op { } elseif $1 == deop { } ... - Since op != deop != voice != devoice, you should put elseif's instead of if's.
When using if's, mIRC's scripting parser will go through each if statement to see if it finds a match. Since our commands are exclusive, as in they are different, you can use elseif's, which makes mIRC not try to match what is in those elseif conditions, as soon as one has matched. In the case of this little snippet, where it is a few lines, it all doesn't matter as much, though in larger snippets, or in snippets where each if check takes some processing, you'll see the difference.
Cya
Gone.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
You can either store the command in a var, or tokenize it so that $1 is filled with the command. Makes your code quite shorter, and easier to read.
I have never actually used this command, I know what it does but for whatever reason it's a habbit to use Token Identifiers, to have the longer and unreadable code, maybe one day I'll adjust. Thanks for the pointers though, have a good one.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
were u trying to cater for someone typeing !!!!!!!!!!!!!!!!!!!!op ?
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
I'm generous dude...no one ever tell you that?
|
|
|
|
|