on *:TEXT:!on-nguess:%nguesschan:{
  /inc %guessgame 1
  /set %starter $nick
  /set %game on
  /set %number $rand(1,100)
  /describe $chan 7The game is now ON. To play, type !nguess <number>. The Secret Number can be between 0 and 100. This is game number %guessgame 
}
on *:TEXT:!nguess*:%nguesschan:{   
  if (on isin %game) {
    if ( $nick !isin %variable ) {      
      if ( $2 < %number ) /describe $chan  $2 is too low...( Last Winner was: %winner This is game number: %guessgame )
      if ( $2 > %number ) /describe $chan  $2 is too high...( Last Winner was: %winner This is game number: %guessgame )
      if ( $2 == %number ) { 
        /msg $chan 7Wowowowow $nick $+ !! That is right! The secret number was %number $+ .Now, type !on-nguess to start a new one.
        /mode $chan %prize $nick
        /set %winner $nick        
        /set %game off
      }
    }
    if ( $nick isin %variable ) /notice $nick Sorry, you are only allowed to guess once in every %waitingtime seconds.
    /set %variable $addtok(%variable,$nick,32)
    timer 1 %waitingtime set %variable $!remtok(%variable, $nick ,1,32)
    timer 1 %waitingtime2 describe $chan $nick can now play...
  }    
  if ( on !isin %game ) /describe $chan 7For the moment the game isn't on...to set the game on, type !on-nguess
}  
on 1:TEXT:!off-nguess:%nguesschan:{
  if ( $nick isin %starter ) {
    /msg $chan 7Guessing Game Has Been Stopped By $nick $+ ...The correct number was %number
    /unset %guess
  }
  if ( $nick !isin %starter ) /notice $nick You didn't start this game...so you cant stop it!
}

menu channel {
  .Number Guess
  ..Options
  ...Set Channel:/set %nguesschan $?="Enter the channel where the game is to be played. Ex: #YourChan"
  ...Show Nicks that can't play:/describe $chan 7Current players that can't guess: %variable
  ...Show correct number:/describe $chan 7The correct number is: %number
  ...Show Waiting time:/describe $chan 7You must wait %waitingtime secs between two guesses. 
  ...Set prize:/set %prize $?="Enter the prize for the person who gets the number right ( possible: +v/-v/+h/-h/+o/-o/+a/-a/+q/-q etc. )" 
  ...Set Waiting time for warning:/set %waitingtime2 $?="Set the time for the warning ( normally 1 sec more than the waiting time )"
  ...Set Waiting time:/set %waitingtime $?="Enter the number of seconds between guesses (example: 300)"
}
