Charmander

New Lottery Script

Jun 14th, 2011
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.26 KB | None | 0 0
  1. on *:join:#scripting: {
  2.   notice $nick Welcome to scripting! Type 4!lottoregister to register your name in the lottery!
  3. }
  4. on *:text:!lottoregister:*: {
  5.   if (!%points [ $+ [ $nick ] ]) {
  6.     set %points [ $+ [ $nick ] ] 5
  7.     notice $nick You have registered successfully! You will start with 5 points. Type 4lottostart to start a lottery drawing!
  8.   }
  9.   elseif (%points [ $+ [ $nick ] ]) {
  10.     notice $nick You are already registered in the lottery.
  11.   }
  12. }
  13. on *:text:!lottostart:*: {
  14.   if (%points $+ $nick && %lottery != on) {
  15.     msg # A lottery drawing has started! A ticket costs 1 point! To buy a ticket, 4!lottobuy.
  16.     set %lottery on
  17.     set %amount 5
  18.   }
  19. }
  20. on *:text:!lottobuy:*: {
  21.   if (%amount > 0 && %points [ $+ [ $nick ] ] > 0 && %lottery == on && $nick !isin %people) {
  22.     dec %points $+ $nick
  23.     notice $nick You have successfully bought a ticket! You have %points [ $+ [ $nick ] ] points left!
  24.     set %people %people $nick
  25.     dec %amount
  26.     msg # $nick has joined the lottery! There are %amount spots open!
  27.   }
  28.   elseif ($nick isin %people) {
  29.     notice $nick You are already in the lottery
  30.   }
  31.   elseif (%points [ $+ [ $nick ] ] == 0) {
  32.     msg # $nick is bankrupt! Contact Charmander if you are bankrupt.
  33.   }
  34.   if (%amount == 0) {
  35.     draw
  36.   }
  37.   elseif (%points $+ $nick < 1) {
  38.     notice $nick You don't have enough points to join the lottery. You might be bankrupt, or you have haven't registered. To register, type 4!lottoregister. If you are bankrupt, contact Charmander.
  39.   }
  40. }
  41. alias draw {
  42.   unset %lottery
  43.   set %winner $gettok(%people,$r(1,$numtok(%people,32)),32)
  44.   msg # Drumroll please...
  45.   timer 1 5 msg # %winner has won the lottery! They will get 5 points.
  46.   inc %points [ $+ [ %winner ] ] 5
  47.   unset %amount
  48.   unset %people
  49.   unset %lottery
  50.   unset %winner
  51. }
  52. on *:text:!lottoscore:*: {
  53.   notice $nick You have %points [ $+ [ $nick ] ] points!
  54. }
  55. on *:text:!lottoend:*: {
  56.   if ($nick isin %poweruser && %lottery == on) {
  57.     unset %amount
  58.     unset %people
  59.     unset %lottery
  60.     msg # the lottery was ended by $nick $+ !
  61.     handback
  62.   }
  63. }
  64. on *:text:!poweruser*:*: {
  65.   if ($nick == Charmander && $$2 !isin %poweruser) {
  66.     set %poweruser %poweruser $$2
  67.     msg # $$2 was added as a poweruser!
  68.   }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment