Advertisement
ruanmed

The Draw Game script by Sashy and ruanmed

Jan 4th, 2014
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 4.48 KB | None | 0 0
  1. ;Draw script by Sashy and ruanmed
  2. ;Sashy sucks
  3. ;January 4th, 2014
  4. ;---------------------------------------------
  5. ;1.Intructions
  6. ;1.1.- Commands
  7. ;1.1.To generate tickets use the command !draw.
  8. ;1.1.After everyone gets their ticket you can pick the winner with the command !pick.
  9. ;---------------------------------------------
  10. ;2.Setting up
  11. ;2.1.- Channel
  12. ;2.1.Set up the channel with a right click on channel window or /drawchannel #channel
  13. ;2.2.E.G: /drawchannel #Draw - Will set the game channel to #Draw
  14. ;2.2.- Spam protection
  15. ;2.2.Set up the amount of time you want the spam protection to be with a right click
  16. ;2.2.on channel window or /drawspamtime [amount_of_seconds]
  17. ;2.2.E.G: /drawspamtime 30 - Will set the spam protection for 30 seconds.
  18. ;2.2.Default time is 60 seconds.
  19. ;---------------------------------------------
  20. ;---------------------------------------------
  21. ;~Have fun
  22.  
  23.  
  24.  
  25. ;---------------------------------------------
  26. ;Dialogs and menus
  27. ;---------------------------------------------
  28.  
  29.  
  30. ;---------------------------------------------
  31. ;Aliases
  32. ;---------------------------------------------
  33. alias drawchannel { ;Alias to set the variable %draw.channel and output confirmation message.
  34.   set %draw.channel $$1
  35.   echo -a 0,1 The Draw Game channel was successfully set to $$1 $+ !
  36. }
  37.  
  38. alias drawspamtime { ;Alias to set the variable %draw.spamtime and output confirmation message.
  39.   set %draw.spamtime $$1
  40.   echo -a 0,1 The spam protection time was successfully set to $$1 seconds!
  41. }
  42.  
  43. ;---------------------------------------------
  44. ;On/Off switcher
  45. ;---------------------------------------------
  46. on *:text:!draw *:%draw.channel: {
  47.   if ($nick isop %draw.channel) {
  48.     if ($$2 == on) {
  49.       enable #draw
  50.       msg $chan The Draw Game script by Sashy and ruanmed was 9enabled!
  51.     }
  52.     if ($$2 == off) {
  53.       disable #draw
  54.       msg $chan The Draw Game script by Sashy and ruanmed was 4disabled!
  55.     }
  56.   }
  57. }
  58.  
  59. ;---------------------------------------------
  60. ;Actions
  61. ;---------------------------------------------
  62. #draw off
  63. on *:text:!draw:%draw.channel: {
  64.   if (%draw. [ $+ [ $nick ] ] == 1) { ;Protection against spammers!
  65.     notice $nick $nick stop being greedy you already got your ticket.
  66.   }
  67.   else { ;Generating dem numbers
  68.     var %n1 = $r(1,10)
  69.     var %n2 = $r(1,10)
  70.     while (%n2 == %n1) {
  71.       var %n2 = $r(1,10)
  72.     }
  73.     var %n3 = $r(1,10)
  74.     while (%n3 == %n2 || %n3 == %n1) {
  75.       var %n3 = $r(1,10)
  76.     }
  77.     var %n4 = $r(1,10)
  78.     while (%n4 == %n3 || %n4 == %n2 || %n4 == %n1) {
  79.       var %n4 = $r(1,10)
  80.     }
  81.     var %n5 = $r(1,10)
  82.     while (%n5 == %n4 || %n5 == %n3 || %n5 == %n2 || %n5 == %n1) {
  83.       var %n5 = $r(1,10)
  84.     }
  85.     var %n6 = $r(1,10)
  86.     while (%n6 == %n5 || %n6 == %n4 || %n6 == %n3 || %n6 == %n2 || %n6 == %n1) {
  87.       var %n6 = $r(1,10)
  88.     }
  89.  
  90.     ;Generating the ticket number
  91.     inc %ticketn
  92.  
  93.     ;Now let's write the info into the tickets.dat file
  94.     writeini -n tickets.dat %ticketn player $nick
  95.     writeini -n tickets.dat %ticketn n1 %n1
  96.     writeini -n tickets.dat %ticketn n2 %n2
  97.     writeini -n tickets.dat %ticketn n3 %n3
  98.     writeini -n tickets.dat %ticketn n4 %n4
  99.     writeini -n tickets.dat %ticketn n5 %n5
  100.     writeini -n tickets.dat %ticketn n6 %n6
  101.  
  102.     ;Sending the message to the channel, so that the socker knows his numbers :<
  103.     msg #Sashy $nick $+ $chr(44) thank you for participating, your numbers are $chr(91) $+ %n1 $+ $chr(93) $chr(91) $+ %n2 $+ $chr(93) $chr(91) $+ %n3 $+ $chr(93) $chr(91) $+ %n4 $+ $chr(93) $chr(91) $+ %n5 $+ $chr(93) $chr(91) $+ %n6 $+ $chr(93) $+ $chr(46) Ticket $chr(35) $+ %ticketn $+ $chr(46)
  104.  
  105.     ;dat spam protection only is in effect because of the following line
  106.     set -u60 %draw. $+ $nick 1
  107.   }
  108. }
  109.  
  110. on *:text:!pick:%draw.channel: {
  111.   if ($nick isop %draw.channel) {
  112.     if (%ticketn != 0) {
  113.       msg $chan Drawing the winning ticket...
  114.  
  115.       ;Generating the winner
  116.       set %ticket $r(1,%ticketn)
  117.       set %winner $readini(tickets.dat,%ticket,player)  
  118.  
  119.       ;Timed message to the channel
  120.       timer 1 5 /msg $chan And our lucky winner is %winner $+ $chr(44) with the ticket $chr(35) $+ %ticket $+ $chr(46)
  121.  
  122.       ;Reseting the ticket count and cleaning the tickets file
  123.       set %ticketn 0
  124.       write -c tickets.dat
  125.     }
  126.     else { ;Message to be sent if there's no tickets
  127.       msg $chan There's currently no tickets registered!
  128.     }
  129.   }
  130. }
  131. #draw end
  132. ;---------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement