A simple Coin Flip Snippet I have just gotten around to update.
Any way to use: !flip heads/tails
Updates: Flood Protection...
on *:TEXT:*:#:{
if ($1 == !flip) && ($istok(heads tails,$2,32)) {
if ($($+(%,fflood,$remove($chan,$chr(35))),5) == $null) {
var %frand = $rand(1,2)
msg # The coin landed on: $iif(%frand == 1,Heads,Tails)
set -u20 $+(%,fflood,$remove($chan,$chr(35))) on
}
else { .notice $nick Command can only be used every 20 seconds! }
}
}
xbox_gamer1, use this one:
on !*:join:#:jp
on !*:part:#:jp
alias -l jp {
if $(,$+(%,jpon.,#)) {
msg # $nick has $iif($event = join,joined,left) #
}
}
on $*:text:/^!jp\so(n|ff)$/iS:#:{
if !$nick(#,$nick,rv) && !%f {
inc -u3 %f
if $regml(1) == n {
set $+(%,jpon.,#) $true
.msg # xbox_gamer1's script is now switched on.
}
else {
.msg # xbox_gamers1's join/part script is now switched off
unset $+(%,jpon.,#)
}
}
}
It'll only respond to the channels where you have the command set for:
!jp on
!jp off
to turn the notice from a channel where you don't want the message shown.
on :JOIN:#:{ if ($($+(%,jpon.,$chan),2) == 0) { halt } | { msg $chan $nick has join $chan } }
on :PART:#:{ if ($($+(%,jpon.,$chan),2) == 0) { halt } | { msg $chan $nick has left $chan } }
on :TEXT:!jp:#: {
if ($nick($chan,$nick,@&~)) {
if ($2 == off) {
set $+(%,jpon.,$chan) 0
msg $chan xbox_gamers1's join/part script is now switched off
}
else if ($2 == on) {
set $+(%,jpon.,$chan) 1
msg $chan xbox_gamer1's script is now switched on
}
}
}
that ok?
Bielie, that's the way to get better by accepting and learning from people's suggestions. I have seen many people mislead others with redundant codes, and that's not an appropriate practice and will likely result in the redundancy being passed down...
set -eu3 %flood [ $+ [ $nick ] ] $true
Use the -l switch> set -l %flip $rand(1,2)to make it local instead of global.
You don't need the -e switch for the trigger control. Because upon existing, mIRC will get a timed variable unset.