16.06.2014, 09:54
OnIncomingConnection is a new callback (added in 0.3z R2-2) Which is called when a player attemp to join the server.
It will return 3 parameters :
I Have tested it with this way:
That isn't because of PlayerName(playerid), Because the result with GetPlayerName is same.
Player Name under this callback is NULL.
It will return 3 parameters :
- playerid (Integer) = That player ID Wants to connect
- ip_address (String) = Player's IP (length = 15)
- port (Int) player's port
I Have tested it with this way:
pawn Код:
stock PlayerName(playerid)
{
new
playerName[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, playerName, sizeof(playerName));
return playerName;
}
pawn Код:
public OnIncomingConnection(playerid, ip_address[], port)
{
printf("Incoming connection for player ID %i - (Name : %s) [IP/port: %s:%i]", playerid, PlayerName(playerid), ip_address, port);
return 1;
}
Player Name under this callback is NULL.