1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
;Trigger script by TwN ;Mainly made for vhn/element from #realbots. ;Have Fun :) ;The on text event... on *:text:*:#:{ ;did the user type !addtrig? if ($1 == !addtrig) { ;Check if there is a hashtable for that channel, if not make it... if (!$hget($chan $+ .trigger)) { hmake $chan $+ .trigger 50 } ;We need atleast a trigger and some text. if (!$3) { msg $chan Error, please specify a trigger and some text. | return } ;If we get here, add the trigger to hash and give a msg back. hadd $chan $+ .trigger $2- msg $chan Done, added trigger ( $+ $2 $+ ) with $qt($3-) ;halt the event return } ;did the user type !deltrig? elseif ($1 == !deltrig) { ;did the user provide a trigger? If not halt the event. if (!$2) { msg $chan Error, please specify a trigger. | return } ;check if $2 is in the hashtable, if not return a msg and halt the event. if (!$hget($chan $+ .trigger,$2)) { msg $chan Error, couldn't find $2 in $chan $+ 's triggers. | return } ;If we get here everythings ok, delete it from the hashtable and give a message back with what he deleted. msg $chan Deleted the trigger ( $+ $2 $+ ) with $hget($chan $+ .trigger,$2) hdel $chan $+ .trigger $2- ;halt the event. return } ;if none of the above is valid, we might check if it is a trigger he wrote, if so msg it :) elseif ($hget($chan $+ .trigger,$1)) { msg $chan $hget($chan $+ .trigger,$1) } } |
| Parsed for bracket errors and indented: | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
;Trigger script by TwN ;Mainly made for vhn/element from #realbots. ;Have Fun :) ;The on text event... on *:text:*:#:{ ;did the user type !addtrig? if ($1 == !addtrig) { ;Check if there is a hashtable for that channel, if not make it... if (!$hget($chan $+ .trigger)) { hmake $chan $+ .trigger 50 } ;We need atleast a trigger and some text. if (!$3) { msg $chan Error, please specify a trigger and some text. | return } ;If we get here, add the trigger to hash and give a msg back. hadd $chan $+ .trigger $2- msg $chan Done, added trigger ( $+ $2 $+ ) with $qt($3-) ;halt the event return } ;did the user type !deltrig? elseif ($1 == !deltrig) { ;did the user provide a trigger? If not halt the event. if (!$2) { msg $chan Error, please specify a trigger. | return } ;check if $2 is in the hashtable, if not return a msg and halt the event. if (!$hget($chan $+ .trigger,$2)) { msg $chan Error, couldn't find $2 in $chan $+ 's triggers. | return } ;If we get here everythings ok, delete it from the hashtable and give a message back with what he deleted. msg $chan Deleted the trigger ( $+ $2 $+ ) with $hget($chan $+ .trigger,$2) hdel $chan $+ .trigger $2- ;halt the event. return } ;if none of the above is valid, we might check if it is a trigger he wrote, if so msg it :) elseif ($hget($chan $+ .trigger,$1)) { msg $chan $hget($chan $+ .trigger,$1) } } |