Development

Players in XAseco1 and XAseco2

The Playerlist in XAseco are accessible in several ways, here i want to show you (hopefully) all possible ways:

Check if there are Players connected
// Bail out if there are no Players
if ( empty($aseco->server->players->player_list) ) {
	return;
}
		
Get the amount of the current connected Players
$amount = count($aseco->server->players->player_list);
		
Check if the Player has left the Server
$login = 'han_solo';
if ( !isset($aseco->server->players->player_list[$login]) ) {
	// Bail out if the Player left the Server
	return;
}
		
Walk through the Playerlist
$login = 'han_solo';
foreach ($aseco->server->players->player_list as &$player) {
	if ($player->login == $login) {
		// Do something...
	}
}
unset($player);
		
Receive a specific Player object from a given $login
$login = 'han_solo';
$player = $aseco->server->players->player_list[$login];
		

With this $player object you can access the Nickname, the Database-Id (for using it in a SQL-Query) and many more of this Player:

Examples
$nick = $player->nickname;
$dbid = $player->id;
		

Do not mix up with $player->id and $player->pid! The $player->id is the Database-Player-Id and $player->pid is the Player-Id from the dedicated Server.

To see all possible variables, just dump the whole $player object into the logfile from XAseco:

Dump $player object
$aseco->console( var_dump($player) );
		

If you only need the Database-Player-Id from a $login, then you can use this, instead of copy the whole Player object (which is huge!):

Get the Database-Player-Id from a given $login
$login = 'han_solo';
$dbid = $aseco->getPlayerId($login);
		
Last modified: Sat, 19 May 2012 21:59:20 +0200
This is a private enthusiast Website. Maniaplanet, Trackmania, Shootmania, Nadeo are trademarks of Ubisoft Entertainment.
XAseco is maintained by Frans P. de Vries.
MPAseco is maintained by Kremsy, ManiacTwister & TheM

Reordered Navigation

Maybe you have already noticed, that i have changed the order in the Navigation. Since now XAseco2 is in front of all others content.

Donate Planets

Donate Coppers

Donate via PayPal

ATOM release feeds

RSS release feeds