Difference between revisions of "How to make a VIP script"
From Scriptwiki
m (grammar) |
m (added category) |
||
Line 71: | Line 71: | ||
if (%vipcheck) { haltdef } | if (%vipcheck) { haltdef } | ||
} | } | ||
+ | |||
+ | [[Category:Tutorials]] |
Revision as of 06:53, 13 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 } }