mohamedraif

Number guessing game

Jul 29th, 2011
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.15 KB | None | 0 0
  1. on *:TEXT:&guess *:#ninja_matt:{
  2.   if (($$2 isnum) && ($$3 isnum)) {
  3.     if (($$2 == 1) && ($$3 == 1)) msg $chan You thought you could get away with that?
  4.     elseif (($$2 != $int($$2)) || ($$3 != $int($$3))) msg $chan Please enter only whole numbers.
  5.     elseif (($$2 < 1) || ($$3 < 1)) msg $chan You can't input numbers less than 1.
  6.     elseif ($$3 < $$2) msg $chan The number you are guessing cannot be higher than maximum value specified.
  7.     else {
  8.       var %num = $rand(1,$$3)
  9.       if (%num == $$2) {
  10.         inc %guess [ $+ [ $nick ] ] $$3
  11.         msg $chan You guessed correct! You just gained  $+ $$3 $+  points.
  12.         msg $chan You now have %guess [ $+ [ $nick ] ] points.
  13.       }
  14.       else {
  15.         dec %guess [ $+ [ $nick ] ] 1
  16.         msg $chan Oops. You guessed wrong, the correct answer was  $+ %num $+ . You just lost 1 point.
  17.         msg $chan You now have %guess [ $+ [ $nick ] ] points.
  18.       }
  19.     }
  20.   }
  21.   else msg $chan Please enter only numbers.
  22. }
  23. on *:TEXT:&guessscore *:#ninja_matt:{
  24.   if (!%guess [ $+ [ $$2 ] ]) msg $chan There is no score recorded for $$2 $+ .
  25.   else msg $chan $$2 has %guess [ $+ [ $$2 ] ] points.
  26. }
Advertisement
Add Comment
Please, Sign In to add comment