Guest User

Raffle System

a guest
Oct 18th, 2014
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.52 KB | None | 0 0
  1. on *:TEXT:!buyticket &:#:{
  2.   if (%open == 1) {
  3.     if ($2 > 10) {
  4.       msg $chan $nick $+ , you cannot 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!
  20.       }
  21.       if (%remove < 0) {
  22.         msg $chan Sorry $nick but you don't have enough points to buy %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.         echo -a Raffle Closed
  50.       }
  51.     }
  52.   }
  53.   if ($1 == !tickets) {
  54.     if (%open == 1) {
  55.       msg $chan There are currently $lines(Raffle.txt) tickets entered into the raffle!
  56.     }
  57.   }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment