Want more features on Pastebin? Sign Up, it's FREE!
Guest

LOTTO SCRIPT TO FIX

By: a guest on Nov 20th, 2011  |  syntax: None  |  size: 10.63 KB  |  views: 116  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ###############################################################
  2. ;--##################Lotto script v3.0######################--;
  3. ###############################################################
  4. ;----
  5. alias -l lottorun return $readini(lot.ini,$1,prize)
  6. alias -l loffn return $iif($($+(%,loffn,$1),5),1,0)
  7. alias -l theme return $read(lottotheme.txt, s, $chan)
  8. alias -l lottostarter return $readini(lot.ini,$1,starter)
  9. ;----
  10. on *:TEXT:*:#:{
  11.   if ($1 == !charter) {
  12.     if ($loffn($chan)) msg # $theme $+ All flights have been delayed.
  13.     elseif ($readini(lot.ini,$chan,prize)) msg # $theme $+ A flight is already ready to take of from $+($chan,.)
  14.     elseif ($2 == $null) msg # $theme $+ Please specify a prize : !charter [prize here].
  15.     else {
  16.       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)) $+ )))
  17.       writeini lot.ini $chan starter $nick
  18.       writeini lot.ini $chan prize $2-
  19.       writeini lot.ini $chan duration $ctime
  20.       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.
  21.     }
  22.   }
  23.   elseif ($1 == !ticket) {
  24.     if ($loffn($chan)) msg # $theme $+ All flights have been delayed.
  25.     elseif ($readini(lot.ini,$chan,starter) == $nick) msg # $theme $+ Sorry the pilot cannot enter.
  26.     elseif (!$read(ids.txt, s, $nick)) msg # $theme $+ $+($nick,$chr(44)) please add your ID: !addid <TornID>.
  27.     elseif (!$readini(lot.ini,$chan,prize)) msg # $theme $+ There are no pilots to take of any flight on $chan
  28.     elseif ($read($+(lot,$chan,.txt),w,$nick)) {
  29.       msg # $theme $+ $+($nick,$chr(44)) Stop fucking typing !ticket. You already have ticket number $lottoticket($chan,$nick) $+ !
  30.     }
  31.     else {
  32.       write $+(lot,$chan,.txt) $nick
  33.       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)) $+ !
  34.     }
  35.   }
  36.   elseif ($1 == !crash) {
  37.     if ($loffn($chan)) msg # $theme $+ All flights have been delayed.
  38.     elseif (!$readini(lot.ini,$chan,prize)) msg # $theme $+ There are no pilots to take of any flights on $chan $+ .
  39.     elseif (!$nick($chan,$nick,@&~)) msg # $theme $+ Sorry $+($nick,$chr(44)) only channel ops or the pilot can use this command.
  40.     else {
  41.       remini lot.ini $chan
  42.       write -c $+(lot,$chan,.txt)
  43.       msg # $theme $+ The current flight has been crashed by $nick $+ .
  44.     }
  45.   }
  46.   elseif ($1 == !fly) {
  47.     if ($loffn($chan)) msg # $theme $+ All flights have been delayed.
  48.     elseif (!$readini(lot.ini,$chan,prize)) msg # $theme There are no pilots to take of any flights on $chan $+ .
  49.     elseif ($nick != $readini(lot.ini,$chan,starter)) && (!$nick($chan,$nick,~&)) msg # $theme $+ $nick $+ , your not the fucking pilot.
  50.     elseif ($lines($+(lot,$chan,.txt)) < 1) msg # $theme $+ There must be at least 1 passenger in the flight to take off.
  51.     else {
  52.       writeini lot.ini $chan winner $read($+(lot,$chan,.txt))
  53.       writeini lot.ini $chan winnerticket $readn
  54.       mode # +m
  55.       msg # $theme $+ The flight has took off......
  56.       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) $+ !
  57.       msg # $theme $+ $readini(lot.ini,$chan,winner) $+ 's ID is: $+([,$read(ids.txt , s, $readini(lot.ini,$chan,winner)),]) $+ .
  58.       if ($readini(lot.ini,$chan,prize) isnum) {
  59.         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)))
  60.       }
  61.       if (*trade* iswm $readini(lot.ini,$chan,prize)) {
  62.         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)))
  63.       }
  64.       .timer 1 2 mode # -m
  65.       remini lot.ini $chan
  66.       write -c $+(lot,$chan,.txt)
  67.     }
  68.   }
  69.   elseif ($1 == !fprize) {
  70.     if ($loffn($chan)) msg # $theme $+ All flights have been delayed.
  71.     elseif (!$readini(lot.ini,$chan,prize)) msg # $theme $+ There are no pilots to take of any flights on $chan $+ .
  72.     else {
  73.       msg # $theme $+ The prize on board is a/an: $lottoprize($chan) $+ , from $readini(lot.ini,$chan,starter)
  74.       msg # $theme $+ There $iif($lines($+(lot,$chan,.txt)) == 1,is $v1 passengers,are $v1 entries) in the flight.
  75.       msg # $theme $+ The flight doors have been open for: $duration($calc($ctime - $readini(lot.ini,$chan,duration))))
  76.     }
  77.   }
  78.   if ($1 == !ftheme)
  79.   elseif (!$readini($chan,prize)) msg # $theme $+ There are no pilots to take of any flights on $chan $+ .
  80.   if (!$regex($nick($chan,$nick).pnick,/(!|@|&|~)/)) msg # $theme $+ Only channel staff may change this channels flight theme.
  81.   else {
  82.     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))))
  83.     write -ds $+ $chan lottotheme.txt | write lottotheme.txt $chan  $+ $2-
  84.     msg # $theme $+ Flight theme for $chan has been updated!
  85.   }
  86. }
  87. elseif ($1 == !editprize) {
  88.   if ($loffn($chan)) msg # $theme $+ All flights have been delayed.
  89.   elseif (!$readini(lot.ini,$chan,prize)) msg # $theme $+ There are no pilots to take of any flights on $chan $+ .
  90.   elseif (!$nick($chan,$nick,@&~)) msgg # $theme $+ Sorry $nick $+ , only ops may use this command.
  91.   else {
  92.     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)) $+ )))
  93.     writeini -n lot.ini $chan prize $2-
  94.     msg # $theme $+ Prize on board has been changed to: $lottoprize($chan) $+ .
  95.   }
  96. }
  97. if ($1 == !fcmds) {
  98.   .msg $nick Lotto commands:
  99.   .msg $nick !charter <prize>, !ticket, !fly. !iflight, !prize, !crash
  100.   if ($nick($chan,$nick,@&~)) .msg $nick !ftheme <color>, !fly <on|off>
  101. }
  102. elseif ($1 == !peak) msg # $theme $+ Peak for # is: $readini(peak.ini,$chan,peak) set on $readini(peak.ini,$chan,date) $+ .
  103. elseif ($1 == !total) msg # $theme $+ Total amount of cash given out in $chan is $ $+ $bytes($($+(%,total,$chan),3),b) $+ .
  104. elseif (You sent * to * iswm $1-) && ($remove($3,$chr(36),$chr(44)) isnum) {
  105.   inc $+(%,total,$chan) $remove($3,$chr(36),$chr(44))
  106.   msg # $theme $+ Total amount of cash given out in $chan is $ $+ $bytes($($+(%,total,$chan),3),b)
  107. }
  108. elseif ($1 == !remove) {
  109.   if ($loffn($chan)) msg # $theme $+ The lotto script is currently disabled.
  110.   elseif (!$readini(lot.ini,$chan,prize)) msg # $theme $+ The lotto is currently inactive in $chan $+ .
  111.   elseif (!$nick($chan,$nick,@&)) msg # $theme $+ Sorry $nick $+ , only ops may remove someone from the current lotto.
  112.   else {
  113.     noop $read($+(lot,$chan,.txt),w,$2)
  114.     write -dl $+ $readn $+(lot,$chan,.txt)
  115.     msg # $theme $+ $2 has been removed from the current lotto.
  116.   }
  117. }
  118. elseif ($1 == !prize) {
  119.   if ($loffn($chan)) msg # $theme $+ The lotto script is currently disabled.
  120.   elseif (!$readini(lot.ini,$chan,prize)) msg # $theme $+ The lotto is currently inactive in $chan $+ .
  121.   else {
  122.     msg # $theme $+ The prize for the current lotto is a/an: $lottoprize($chan) $+ , donated by $readini(lot.ini,$chan,starter)
  123.   }
  124. }
  125. elseif ($1-2 == !fli on) {
  126.   if (!$regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) {
  127.     msg # $theme $+ Sorry $nick $+ , only channel staff or lotto admins may use this command.
  128.   }
  129.   else {
  130.     unset $+(%,loffn,$chan)
  131.     msg # $theme $+ Lottery systems Enabled.
  132.   }
  133. }
  134. elseif ($1-2 == !fli off) {
  135.   if (!$regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) {
  136.     msg # $theme $+ Sorry $nick $+ , only channel staff or lotto admins may use this command.
  137.   }
  138.   else {
  139.     set $+(%,loffn,$chan) on
  140.     msg # $theme $+ Lottery systems Disabled.
  141.     remini lot.ini $chan
  142.     write -c $+(lotto,$chan,.txt)
  143.   }
  144. }
  145. on *:QUIT:{
  146.   if ($read($+(lot,$chan,.txt),w,$nick)) {
  147.     write -dl $+ $readn $+(lot,$chan,.txt)
  148.     msg # $nick has been removed from $&
  149.       the current lotto on Quit.
  150.   }
  151.   if ($lottorun($chan)) {
  152.     if ($nick == $lottostarter($chan)) {
  153.       msg # $theme $+ The lotto has been cancelled, $&
  154.         because $readini(lot.ini,$chan,starter) $&
  155.         left the channel.
  156.       remini lot.ini $chan
  157.       write -c $+(lot,$chan,.txt)
  158.     }
  159.   }
  160. }
  161. on *:PART:#:{
  162.   if ($read($+(lot,$chan,.txt),w,$nick)) {
  163.     write -dl $+ $readn $+(lot,$chan,.txt)
  164.     msg $chan $theme $+ $nick has been removed from the $&
  165.       current lotto because they left the channel.
  166.   }
  167.   if ($lottorun($chan)) {
  168.     if ($nick == $lottostarter($chan)) {
  169.       msg $chan $theme $+ The lotto has been cancelled $&
  170.         because $readini(lot.ini,$chan,starter) $&
  171.         left the channel.
  172.       remini lot.ini $chan
  173.       write -c $+(lot,$chan,.txt)
  174.     }
  175.   }
  176. }
  177. on *:KICK:#:{
  178.   if ($read($+(lot,$chan,.txt),w,$knick)) {
  179.     write -dl $+ $readn $+(lot,$chan,.txt)
  180.     msg $chan $theme $+ $knick has been removed from $&
  181.       from the current lotto on kick.
  182.   }
  183.   if ($lottorun($chan)) {
  184.     if ($knick == $lottostarter($chan)) {
  185.       msg $chan $theme $+ The lotto has been cancelled $&
  186.         because $readini(lot.ini,$chan,starter) $&
  187.         was kicked from the channel.
  188.       remini lot.ini $chan
  189.       write -c $+(lot,$chan,.txt)
  190.     }
  191.   }
  192. }
  193. on *:NICK:{
  194.   var %x 1
  195.   while (%x <= $chan(0)) {
  196.     if ($read($+(lotto,$chan(%x),.txt),w,$nick)) write -l $+ $readn $+(lot,$chan(%x),.txt) $newnick
  197.     if ($lottostarter($chan(%x)) == $nick) writeini -n lot.ini $chan(%x) starter $newnick
  198.     inc %x
  199.   }
  200. }
  201. alias -l lottoprize {
  202.   var %x $readini(lot.ini,$1,prize)
  203.   if (%x isnum) && (!$2) return $chr(36) $+ $comma(%x)
  204.   else return %x
  205. }
  206. alias -l lottoticket {
  207.   if ($read($+(lot,$1,.txt),w,$2)) { return $iif($3,$lines($+(lot,$,.txt)),$readn) }
  208. }
  209. alias -l comma {
  210.   var %a, %b = $regsub($ticks,$1,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%a)
  211.   return %a
  212. }
  213. on *:JOIN:#:{
  214.   if (!$read(ids.txt,s,$nick)) {
  215.     .notice $nick There is no ID added for your nick, please add it with: !addid <TornID>.
  216.   }
  217.   if ($readini(peak.ini, $chan, peak) < $nick($chan,0)) || (!$readini(peak.ini, $chan, peak)) {
  218.     writeini peak.ini $chan peak $nick($chan,0)
  219.     writeini peak.ini $chan date $date
  220.     msg # $theme $+ New Peak for # set on $readini(peak.ini,$chan,date) is $readini(peak.ini,$chan,peak)
  221.   }
  222. }
  223.  
clone this paste RAW Paste Data