All pastes #821697 Raw Edit

Untitled

public text v1 · immutable
·published 2007-12-18 08:22 UTC
rendered paste body
alias set_players { }

alias stop_hangman { 
  if (%hangman.status == on) {
    msg %hangman.chan The current game has been stopped.
    set %hangman.status off | unset %player*

  }
  else {
    msg %hangman.chan The game is not running right now!
    halt
  }
}

alias start_hangman {
  if (%hangman.chan == $null) { 
    set %hangman.chan $input(Enter the name of the channel hangman will play in:,egoq)
    begin
  }
  else { begin | set %hangman.status on | set %players 1 }
}

alias begin {
  if (%hangman.status == off) { 
    if ($hget(Players) == $null) { 
      hmake -s Players 10
    }
    else {    
      msg %hangman.chan Hangman is now started. To participate, please do !join, remember up to 5 people at a time please. 
    }
  }
  elseif (%hangman.status == on) {
    msg %hangman.chan Hangman is currently being played. To turn it off type !hmstop.
  }
  else { halt }
}

on *:text:*:%hangman.chan: {
  if ($1 == !join) { 
    if (%hangman.status == off) || (%hangman.status == $null) {      
      msg %hangman.chan Hangman is not currently running, we will not be accepting players at this time, sorry. | halt
    }  
    else {  
      if (%players < 6) {
        if ($hget(Players,$+($nick,.joined)) = $true ) {
          msg %hangman.chan Sorry but you already have registered, let other people play.
        }
        else {
          msg %hangman.chan Ladies and Gentlemen, $nick has joined the game! We now have %players Players ready to play. 
          hadd Players $+($nick,.joined) $true
          inc %players 
        }
      }
      elseif (%players > 6) { 
        msg %hangman.chan We have all 5 players registered and ready to play. Game will begin.
      }
    } 
  }
}