public function on_REMOVEhang_Hb() { $argv = $this->argv(); if (1 !== ($argc = count($argv))) { return $this->showHelp('-hang'); } $hang_word = strtolower($argv[0]); if (false === ($word = Hangman_Words::getByWord($hang_word)) && false === ($word = Hangman_Words::getByID($hang_word))) { return $this->rply('err_word'); } $id = $word->getID(); if (false === $word->delete()) { return Dog::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->rply('msg_deleted', array($word->getVar('hangman_text'), $id)); }
private function onStartGame($iso) { if (false === ($this->solution = Hangman_Words::getRandomWord($iso))) { $this->sendOutput('something went wrong! Database error while selecting a random word! cannot play, sorry!'); return false; } $this->sendOutput('Hangman started. '); $this->finish = false; $this->lastNick = NULL; $this->lastTime = time(); $this->guesses = ''; $length = strlen($this->solution); $this->grid = str_pad('', $length, $this->CONFIG['placeholder']); $this->sendGrid(); $this->sendOutput(' '); $this->lives = $this->CONFIG['lives']; $this->sendLivesLeft(); return true; }