###############################################################
;--##################Lotto script v3.0######################--;
###############################################################
;----
alias -l lottorun return $readini(lot.ini,$1,prize)
alias -l loffn return $iif($($+(%,loffn,$1),5),1,0)
alias -l theme return $read(lottotheme.txt, s, $chan)
alias -l lottostarter return $readini(lot.ini,$1,starter)
;----
on *:TEXT:*:#:{
if ($1 == !charter) {
if ($loffn($chan)) msg # $theme $+ All flights have been delayed.
elseif ($readini(lot.ini,$chan,prize)) msg # $theme $+ A flight is already ready to take of from $+($chan,.)
elseif ($2 == $null) msg # $theme $+ Please specify a prize : !charter [prize here].
else {
if ($remove($2-,$chr(32),$chr(46),$chr(44),m,k,b,il) isnum) tokenize 32 $1 $calc($regsubex($ticks,$remove($2-,$chr(44),$chr(32),il),/(^|[+-/*^%]+|[+-/^*%]+\50|\50+|\50)(([0-9]|\56)+)(k|m|b)/Sig,\1 $+ ( $+ \2 $+ $iif(\4 == b,*1000000000,$iif(\4 == m,*1000000,*1000)) $+ )))
writeini lot.ini $chan starter $nick
writeini lot.ini $chan prize $2-
writeini lot.ini $chan duration $ctime
msg # $theme $+ $readini(lot.ini,$chan,starter) has entered the pilots seat on $+($chan,$chr(44)) with a/an: $lottoprize($chan) on board. Type !ticket to get a ticket to the flight.
}
}
elseif ($1 == !ticket) {
if ($loffn($chan)) msg # $theme $+ All flights have been delayed.
elseif ($readini(lot.ini,$chan,starter) == $nick) msg # $theme $+ Sorry the pilot cannot enter.
elseif (!$read(ids.txt, s, $nick)) msg # $theme $+ $+($nick,$chr(44)) please add your ID: !addid <TornID>.
elseif (!$readini(lot.ini,$chan,prize)) msg # $theme $+ There are no pilots to take of any flight on $chan
elseif ($read($+(lot,$chan,.txt),w,$nick)) {
msg # $theme $+ $+($nick,$chr(44)) Stop fucking typing !ticket. You already have ticket number $lottoticket($chan,$nick) $+ !
}
else {
write $+(lot,$chan,.txt) $nick
msg # $theme $+ $+($nick,$chr(44)) you have bought a ticket to the flight to win a/an: $+($lottoprize($chan),$chr(44)) you have ticket number $lines($+(lot,$chan,.txt)) $+ !
}
}
elseif ($1 == !crash) {
if ($loffn($chan)) msg # $theme $+ All flights have been delayed.
elseif (!$readini(lot.ini,$chan,prize)) msg # $theme $+ There are no pilots to take of any flights on $chan $+ .
elseif (!$nick($chan,$nick,@&~)) msg # $theme $+ Sorry $+($nick,$chr(44)) only channel ops or the pilot can use this command.
else {
remini lot.ini $chan
write -c $+(lot,$chan,.txt)
msg # $theme $+ The current flight has been crashed by $nick $+ .
}
}
elseif ($1 == !fly) {
if ($loffn($chan)) msg # $theme $+ All flights have been delayed.
elseif (!$readini(lot.ini,$chan,prize)) msg # $theme There are no pilots to take of any flights on $chan $+ .
elseif ($nick != $readini(lot.ini,$chan,starter)) && (!$nick($chan,$nick,~&)) msg # $theme $+ $nick $+ , your not the fucking pilot.
elseif ($lines($+(lot,$chan,.txt)) < 1) msg # $theme $+ There must be at least 1 passenger in the flight to take off.
else {
writeini lot.ini $chan winner $read($+(lot,$chan,.txt))
writeini lot.ini $chan winnerticket $readn
mode # +m
msg # $theme $+ The flight has took off......
msg # $theme $+ $readini(lot.ini,$chan,winner) is flying away with a/an $lottoprize($chan) from $lottostarter($chan) with ticket number $readini(lot.ini,$chan,winnerticket) $+ !
msg # $theme $+ $readini(lot.ini,$chan,winner) $+ 's ID is: $+([,$read(ids.txt , s, $readini(lot.ini,$chan,winner)),]) $+ .
if ($readini(lot.ini,$chan,prize) isnum) {
msg # $theme $+ Send $readini(lot.ini,$chan,winner) cash: $+(http://www.torn.com/sendcash.php?XID=,$read(ids.txt , s, $readini(lot.ini,$chan,winner)))
}
if (*trade* iswm $readini(lot.ini,$chan,prize)) {
msg # $theme $+ Trade with $readini(lot.ini,$chan,winner) $+ : $+(http://www.torn.com/trade.php?step=start&userID=,$read($idfl, s, $readini(lot.ini,$chan,winner)))
}
.timer 1 2 mode # -m
remini lot.ini $chan
write -c $+(lot,$chan,.txt)
}
}
elseif ($1 == !fprize) {
if ($loffn($chan)) msg # $theme $+ All flights have been delayed.
elseif (!$readini(lot.ini,$chan,prize)) msg # $theme $+ There are no pilots to take of any flights on $chan $+ .
else {
msg # $theme $+ The prize on board is a/an: $lottoprize($chan) $+ , from $readini(lot.ini,$chan,starter)
msg # $theme $+ There $iif($lines($+(lot,$chan,.txt)) == 1,is $v1 passengers,are $v1 entries) in the flight.
msg # $theme $+ The flight doors have been open for: $duration($calc($ctime - $readini(lot.ini,$chan,duration))))
}
}
if ($1 == !ftheme) {
elseif (!$readini($chan,prize)) msg # $theme $+ There are no pilots to take of any flights on $chan $+ .
if (!$regex($nick($chan,$nick).pnick,/(!|@|&|~)/)) msg # $theme $+ Only channel staff may change this channels flight theme.
else {
if ($2 isnum 0-15) || ($gettok($2,1,44) isnum 0-15) && ($gettok($2,2,44) isnum 0-15) && ($regex($2,/^[0-9]{1,2}\54[0-9]{1,2}$/i))))
write -ds $+ $chan lottotheme.txt | write lottotheme.txt $chan $+ $2-
msg # $theme $+ Flight theme for $chan has been updated!
}
}
elseif ($1 == !editprize) {
if ($loffn($chan)) msg # $theme $+ All flights have been delayed.
elseif (!$readini(lot.ini,$chan,prize)) msg # $theme $+ There are no pilots to take of any flights on $chan $+ .
elseif (!$nick($chan,$nick,@&~)) msgg # $theme $+ Sorry $nick $+ , only ops may use this command.
else {
if ($remove($2-,$chr(32),$chr(46),$chr(44),m,k,b,il) isnum) tokenize 32 $1 $calc($regsubex($ticks,$remove($2-,$chr(44),$chr(32),il),/(^|[+-/*^%]+|[+-/^*%]+\50|\50+|\50)(([0-9]|\56)+)(k|m|b)/Sig,\1 $+ ( $+ \2 $+ $iif(\4 == b,*1000000000,$iif(\4 == m,*1000000,*1000)) $+ )))
writeini -n lot.ini $chan prize $2-
msg # $theme $+ Prize on board has been changed to: $lottoprize($chan) $+ .
}
}
if ($1 == !fcmds) {
.msg $nick Lotto commands:
.msg $nick !charter <prize>, !ticket, !fly. !iflight, !prize, !crash
if ($nick($chan,$nick,@&~)) .msg $nick !ftheme <color>, !fly <on|off>
}
elseif ($1 == !peak) msg # $theme $+ Peak for # is: $readini(peak.ini,$chan,peak) set on $readini(peak.ini,$chan,date) $+ .
elseif ($1 == !total) msg # $theme $+ Total amount of cash given out in $chan is $ $+ $bytes($($+(%,total,$chan),3),b) $+ .
elseif (You sent * to * iswm $1-) && ($remove($3,$chr(36),$chr(44)) isnum) {
inc $+(%,total,$chan) $remove($3,$chr(36),$chr(44))
msg # $theme $+ Total amount of cash given out in $chan is $ $+ $bytes($($+(%,total,$chan),3),b)
}
elseif ($1 == !remove) {
if ($loffn($chan)) msg # $theme $+ The lotto script is currently disabled.
elseif (!$readini(lot.ini,$chan,prize)) msg # $theme $+ The lotto is currently inactive in $chan $+ .
elseif (!$nick($chan,$nick,@&)) msg # $theme $+ Sorry $nick $+ , only ops may remove someone from the current lotto.
else {
noop $read($+(lot,$chan,.txt),w,$2)
write -dl $+ $readn $+(lot,$chan,.txt)
msg # $theme $+ $2 has been removed from the current lotto.
}
}
elseif ($1 == !prize) {
if ($loffn($chan)) msg # $theme $+ The lotto script is currently disabled.
elseif (!$readini(lot.ini,$chan,prize)) msg # $theme $+ The lotto is currently inactive in $chan $+ .
else {
msg # $theme $+ The prize for the current lotto is a/an: $lottoprize($chan) $+ , donated by $readini(lot.ini,$chan,starter)
}
}
elseif ($1-2 == !fli on) {
if (!$regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) msg # $theme $+ Sorry $nick $+ , only channel staff or lotto admins may use this command.
else {
unset $+(%,loffn,$chan)
msg # $theme $+ Lottery systems Enabled.
}
}
elseif ($1-2 == !fli off) {
if (!$regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) msg # $theme $+ Sorry $nick $+ , only channel staff or lotto admins may use this command.
else {
set $+(%,loffn,$chan) on
msg # $theme $+ Lottery systems Disabled.
remini lot.ini $chan | write -c $+(lotto,$chan,.txt)
}
}
}
Should work.