I know thatfarfa wrote:There is a chat command to open the pluginManagerit's pluginmanager

but as openWindow metho isn't set as public :
Code: Select all
$this->setPublicMethod('openWindow');
Moderator: NADEO
I know thatfarfa wrote:There is a chat command to open the pluginManagerit's pluginmanager
Code: Select all
$this->setPublicMethod('openWindow');
Code: Select all
class Test extends \ManiaLive\PluginHandler\Plugin
{
function onInit()
{
$this->setVersion(1.0);
}
function onLoad()
{
$this->enableStorageEvents();
$this->enableDedicatedEvents();
}
function onPlayerFinish($playerid, $login, $time)
{
if($time != 0)
$this->connection->chatSendServerMessage($login." finish. Time : ".Time::fromTM($time));
}
function onPlayerNewBestTime($player, $best_old, $best_new)
{
$this->connection->chatSendServerMessage($player->login." : New best time : ".Time::fromTM($best_new).". (Old was ".Time::fromTM($best_old).")");
}
function onBeginRace($challenge)
{
$this->connection->chatSendServerMessage("\$FF0Challenge is now : ".$challenge['Name']);
}
}
Code: Select all
foreach($this->players as $player)
{
$player->bestTime = 0;
$player->score = 0;
}
foreach($this->spectators as $spectator)
{
$spectator->bestTime = 0;
$spectator->score = 0;
}
Code: Select all
-> ManiaLive\DedicatedApi\Xmlrpc\Exception with code -1000
Login unknown.
Knutselmaaster wrote:It has been fixed.
Before the error was playeruid unknown.
See it more as an announcement in stead of an error
It is a player that has left, and ml says that it can't find the login.
We don't even want that login so why should we worry
Code: Select all
function onPlayerConnect($login, $isSpectator)
{
try
{
$playerInfos = Connection::getInstance()->getPlayerInfo($login, 1);
$details = Connection::getInstance()->getDetailedPlayerInfo($login);
foreach($details as $key => $value)
{
if($value)
{
$param = lcfirst($key);
$playerInfos->$param = $value;
}
}
if($isSpectator)
{
$this->spectators[$login] = $playerInfos;
}
else
{
$this->players[$login] = $playerInfos;
}
}
// if player can not be added to array, then we stop the onPlayerConnect event!
catch(\Exception $e)
{
if($e->getCode() == -1000 && $e->getMessage() == 'Login unknown.')
{
throw new SilentCriticalEventException($e->getMessage());
}
else
{
throw new CriticalEventException($e->getMessage());
}
}
}
Users browsing this forum: No registered users and 1 guest