Difference between revisions of "How to make a VIP script"
From Scriptwiki
m (typo) |
m (grammar) |
||
Line 1: | Line 1: | ||
− | How to check if a user is opped on some channel where you/ | + | How to check if a user is opped on some channel where you/your bot isn't. |
− | We'll be using vipchannels.txt to store the VIP channels we want to check, each channel on | + | We'll be using vipchannels.txt to store the VIP channels we want to check, each channel on their own line, ie: |
#myvipchannel | #myvipchannel | ||
#somechannel | #somechannel | ||
Line 8: | Line 8: | ||
on !*:join:#YOURCHAN:{ | on !*:join:#YOURCHAN:{ | ||
− | ; We'll set a temporary global variable to indicate | + | ; We'll set a temporary global variable to indicate that we're checking the VIP, so we can halt the default /whois text from showing up |
− | ; Then we'll do whois on the nick | + | ; Then we'll do whois on the nick. Note the "!" in the join event: it prevents the script from triggering, if it is you who joined |
set %vipcheck 1 | set %vipcheck 1 | ||
whois $nick | whois $nick | ||
Line 35: | Line 35: | ||
} | } | ||
− | ; haltdef so that you | + | ; haltdef so that you don't see the channels everytime someone joins |
haltdef | haltdef | ||
} | } | ||
Line 52: | Line 52: | ||
} | } | ||
raw 311:*:{ | raw 311:*:{ | ||
− | ; | + | ; user's ident, host and realname |
if (%vipcheck) { haltdef } | if (%vipcheck) { haltdef } | ||
} | } |
Revision as of 17:51, 12 June 2007
How to check if a user is opped on some channel where you/your bot isn't. We'll be using vipchannels.txt to store the VIP channels we want to check, each channel on their own line, ie:
#myvipchannel #somechannel #help.script
On to the script:
on !*:join:#YOURCHAN:{ ; We'll set a temporary global variable to indicate that we're checking the VIP, so we can halt the default /whois text from showing up ; Then we'll do whois on the nick. Note the "!" in the join event: it prevents the script from triggering, if it is you who joined set %vipcheck 1 whois $nick } raw 319:*:{ ; Channels list ; In this raw we loop through the txt-file vipchannels.txt and see if the user is opped on any of these channels ; This will only be done when the %vipcheck is set if (%vipcheck) { var %x = 1 while ($read(vipchannels.txt,%x)) { ; put the channel name into a variable %c var %c = $v1 ; see if $+(@,%c) (equals: @ $+ #somevipchannel) is found from the users channels if ($istok($3-,$+(@,%c),32)) { ; @#somevipchannel was found, so the user is opped on this channel, we tell the user that he's a vip, and set mode +o for him on another chan (note that $2 is the users nick here) msg $2 you are opped on %c $+ , and that makes you a VIP. mode #YOURCHAN +o $2 break } inc %x } ; haltdef so that you don't see the channels everytime someone joins haltdef } } raw 318:*:{ ; end of /whois ; here we just unset the temporary variable %vipcheck, so we can use normal /whois again if (%vipcheck) { unset %vipcheck | haltdef } } ;;; Halting other /whois information from showing up raw 301:*:{ ; away if (%vipcheck) { haltdef } } raw 311:*:{ ; user's ident, host and realname if (%vipcheck) { haltdef } } raw 312:*:{ ; server information if (%vipcheck) { haltdef } } raw 313:*:{ ; if the user is IRCop if (%vipcheck) { haltdef } } raw 317:*:{ ; signon and idle time if (%vipcheck) { haltdef } } raw 330:*:{ ; users auth if (%vipcheck) { haltdef } }