Charmander

Lottery Script

Jun 13th, 2011
854
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.83 KB | None | 0 0
  1. on *:join:#scripting: {
  2.   notice $nick Welcome to scripting! Type 4lottoregister to register your name in the lottery!
  3. }
  4. on *:text:!lottoregister:#scripting: {
  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.     echo -a You are already registered in the lottery.
  11.   }
  12. }
  13. on *:text:!lottostart:#scripting: {
  14.   if (%points $+ $nick) {
  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:#scripting: {
  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.   if (%amount == 0) {
  32.     draw
  33.   }
  34.   elseif (%points $+ $nick < 1) {
  35.     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.
  36.   }
  37. }
  38. alias draw {
  39.   unset %lottery
  40.   set %winner $gettok(%people,$r(1,$numtok(%people,32)),32)
  41.   set %winner $gettok(%people,$r(1,$numtok(%people,32)),32)
  42.   msg # Drumroll please...
  43.   timer 1 5 msg # %winner has won the lottery! They will get 5 points.
  44.   inc %points [ $+ [ %winner ] ] 5
  45.   unset %amount
  46.   unset %people
  47.   unset %lottery
  48.   unset %winner
  49. }
  50. on *:text:!lottoscore:#scripting: {
  51.   notice $nick You have %points [ $+ [ $nick ] ] points!
  52. }
Advertisement
Add Comment
Please, Sign In to add comment