/** * 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); }