Page 2 of 2

Re: ManiaLive 1.0 r223

Posted: 13 Jun 2011, 12:38
by oliverde8
farfa wrote:There is a chat command to open the pluginManager ;) it's pluginmanager
I know that :D I want to add a button to my menu that will do the same.

but as openWindow metho isn't set as public :

Code: Select all

$this->setPublicMethod('openWindow');
The menu can't use it, It would be nice if you add thaty line for the next version.

Re: ManiaLive 1.0 r223

Posted: 14 Jun 2011, 22:32
by Fadden
Hello !

I try to create my first manialive plugin but I have a problem... :?
Is there a bug with the onPlayerNewBestTime event ?

My code (for test) is :

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']);
	}
}
I think it should be run as (for onPlayerNewBestTime) :
- When a player finish a track, if it's his best time on the track since the start of it, onPlayerNewBestTime trigger.

But I have that :
Image

I feel that the best time is not reset between the tracks. But as we can see at the before-last line, the best time of the last track was stored but the onPlayerNewBestTime was not triggered.
Is it a bug or there is something I didn't understand ?

Re: ManiaLive 1.0 r223

Posted: 15 Jun 2011, 00:24
by 4lturbo
Yes, there is a bug, add this code in ManiaLive/Data/Storage.php -> onBeginChallenge() (line 312):

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;
}
or download the last ML version in google code project.
The next release will be out soon

Re: ManiaLive 1.0 r223

Posted: 15 Jun 2011, 17:48
by Fadden
Ok thanks :)

Re: ManiaLive 1.0 r223

Posted: 15 Jun 2011, 18:22
by oliverde8
It seems thre is a problem wit the PHP Memory Limit in the Profiler, The value shown shoudl be divised by 1024.

I didn't look at the code but on my Linux server as well as on my Windows test server the values in the window is false.

Re: ManiaLive 1.0 r223

Posted: 17 Jun 2011, 09:01
by oliverde8
Hi again,

I just wanted to make a widget for Dedimania and saw that it was impossible, ot at least think it is.

There is no event Dispatching on newDediRecord for exemple or an event letting us know dedimania records has been loaded. And I couldn't see any way to get the dedimania Record list, there isn't any public method I can call.

Can we hope an update?

Re: ManiaLive 1.0 r223

Posted: 19 Jun 2011, 12:03
by nouseforname
lot of this error in log:

Code: Select all

 -> ManiaLive\DedicatedApi\Xmlrpc\Exception with code -1000
    Login unknown.
long time known, but no change yet....


need mroe info? just ask

Re: ManiaLive 1.0 r223

Posted: 19 Jun 2011, 20:38
by Knutselmaaster
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 :lol:

Re: ManiaLive 1.0 r223

Posted: 19 Jun 2011, 20:51
by nouseforname
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 :lol:

well than avoid the output :) if its not an error there is no need to print it into the error log.

Re: ManiaLive 1.0 r223

Posted: 19 Jun 2011, 21:00
by w1lla
A better explanation:

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());
                  }
           }
    }
File:

libraries/ManiaLive/Data/Storage.php
Line 228 downwards.