All pastes #829472 Raw Edit

Stuff

public text v1 · immutable
#829472 ·published 2007-12-23 05:13 UTC
rendered paste body
ON $*:TEXT:/^[!@.](dm|deathmatch|enddm|endmatch)/Si:#:{
  if (enddm iswm $1) { dm -end $chan }
  if ($DM($chan).active) { msg # 10There is a game open! Please wait for it to finish | halt }
  if ($DM($chan).pend) {
    if ($nick == $DM($chan).waiting) { msg # 10Dont try to dm yourself! | halt }
    DM -i # $nick | msg # 10DM Started! Its $DM($chan).turn $+ $chr(39) $+ $chr(115) $+ $chr(32) $+ turn!
  }
  else { DM -i # $nick | msg # 10The mighty 7 $+ $nick 10 wants to DM someone! If you wish to challenge him type !dm }
  halt
}

alias dm {
  if ($isid) goto prop
  if (!$2) { /echo -a 2 $+ * /dm - Insufficient paramaters }
  if ($1 == -i) { 
    if (!$regex($2,/#(.*)/)) {
      if (!$hget(Players,Player1)) {
        hadd Players Player1 $3
        hsave -o Players players.hsh
        echo -a Player added!
      }
      elseif {$hget(Players,Player1)) {
        hadd Players Player2 $3
        hsave -o Players players.hsh
        echo -a Player added!
      }
      else {
        /echo -a 2 $+ * /dm - Error cannot write to hash table Players
      }
    }
  }
  :prop
  var %i = $prop
  if (%i == waiting) {
    if ($regex($1,#(.*)) {
      return $hget(Players,Player1)
    }
  }
  if (%i == turn) {
    if (!$regex($2,/#(.*)/)) {
      return $hget(Players,Player $+ $r(1,2))
    }
  }
}