Advertisement
Guest User

Raffle

a guest
Dec 18th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.58 KB | None | 0 0
  1. on *:TEXT:!buyticket &:#:{
  2.   if (%open == 1) {
  3.     if ($2 > 10) {
  4.       msg $chan $nick you can not buy that many tickets!
  5.     }
  6.     if ($2 < 11) {
  7.       var %i = 0
  8.       var %count = $2
  9.       var %topic = $+(#,.,$nick)
  10.       var %user = $readini(Points.ini,%topic,Points)
  11.       var %final = 10 * %count
  12.       var %remove = %user - %final
  13.       if (%remove > 0) {
  14.         writeini -n Points.ini %topic Points %remove
  15.         while (%i < %count) {
  16.           write Raffle.txt $nick
  17.           %i = %i + 1
  18.         }
  19.         msg $chan $nick has bought %count tickets spending %final points, leaving them with %remove left!
  20.       }
  21.       if (%remove < 0) {
  22.         msg $chan Sorry $nick but you dont have enough points to by %count tickets!
  23.       }
  24.     }
  25.   }
  26. }
  27. on *:TEXT:*:#:{
  28.   if ($nick isop #) {
  29.     if ($1 == !raffle) {
  30.       if ($2 == open) {
  31.         msg $chan /me [**RAFFLE STARTED**]
  32.         set %open 1
  33.         write -c Raffle.txt
  34.         echo -a Raffle Started
  35.       }
  36.       if ($2 == close) {
  37.         msg $chan /me [**RAFFLE CLOSED**]
  38.         set %open 0
  39.         write -c Raffle.txt
  40.         echo -a Raffle Closed
  41.       }
  42.     }
  43.     if ($1 == !draw) {
  44.       if (%open == 1) {
  45.         var %user = $read(Raffle.txt,n)
  46.         write -c Raffle.txt
  47.         set %open 0
  48.         msg $chan /me And the winner is... %user !!! Well Done!
  49.         set %open 0
  50.         write -c Raffle.txt
  51.         echo -a Raffle Closed
  52.       }
  53.     }
  54.   }
  55.   if ($1 == !tickets) {
  56.     if (%open == 1) {
  57.       msg $chan There are currently $lines(Raffle.txt) tickets entered!
  58.     }
  59.   }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement