/** * Call a vote for a command. * You can additionally supply specific parameters for this vote: a ratio, a time out and who is voting. * Only available to Admin. * @param Structures\Vote $vote * @param float $ratio In range [0,1] or -1 for default ratio * @param int $timeout In milliseconds, 0 for default timeout, 1 for indefinite * @param int $voters 0: active players, 1: any player, 2: everybody including pure spectators * @param bool $multicall * @return bool * @throws InvalidArgumentException */ function callVote($vote, $ratio = -1.0, $timeout = 0, $voters = 1, $multicall = false) { if (!($vote instanceof Structures\Vote && $vote->isValid())) { throw new InvalidArgumentException('vote = ' . print_r($vote, true)); } if (!Structures\VoteRatio::isRatio($ratio)) { throw new InvalidArgumentException('ratio = ' . print_r($ratio, true)); } if (!is_int($timeout)) { throw new InvalidArgumentException('timeout = ' . print_r($timeout, true)); } if (!is_int($voters) || $voters < 0 || $voters > 2) { throw new InvalidArgumentException('voters = ' . print_r($voters, true)); } $xml = Xmlrpc\Request::encode($vote->cmdName, $vote->cmdParam, false); return $this->execute(ucfirst(__FUNCTION__) . 'Ex', array($xml, $ratio, $timeout, $voters), $multicall); }
/** * Call a vote to go to the next Map. * You can additionally specifiy specific parameters for this vote: a ratio, a time out * and who is voting. Special timeout values: a timeout of '0' means default, '1' means * indefinite; a ratio of '-1' means default; Voters values: '0' means only active players, * '1' means any player, '2' is for everybody, pure spectators included. * @param double $ratio -1 means default, else ration should be between 0 and 1 * @param int $timeout time to vote in millisecondes, '0' means default * @param int $voters Voters values: '0' means only active players, '1' means any player, '2' is for everybody, pure spectators included * @param bool $multicall * @throws InvalidArgumentException */ function callVoteNextMap($ratio = 0.5, $timeout = 0, $voters = 1, $multicall = false) { if (!is_float($ratio)) { throw new InvalidArgumentException('ratio = ' . print_r($ratio, true)); } if (!is_int($timeout)) { throw new InvalidArgumentException('timeout = ' . print_r($timeout, true)); } if (!is_int($voters)) { throw new InvalidArgumentException('voters = ' . print_r($voters, true)); } $tmpCmd = new Xmlrpc\Request('NextMap', array()); return $this->execute('CallVoteEx', array($tmpCmd->getXml(), $ratio, $timeout, $voters), $multicall); }