18.10.2010, 11:28
The way I get around any upon-connect issues (saw Simon do it years ago and I started, aswell):
This will wait with any actions until the player is fully connected.
This will wait with any actions until the player is fully connected.
pawn Код:
new
bool:g_IsFullyConnected[ MAX_PLAYERS char ]
;
public OnPlayerConnect( playerid )
{
if ( g_IsFullyConnected{ playerid } )
{
// do stuff ..
}
}
public OnPlayerDisconnect( playerid, reason )
{
g_IsFullyConnected{ playerid } = false;
}
public OnPlayerRequestClass( playerid, classid )
{
if ( !g_IsFullyConnected{ playerid } )
{
g_IsFullyConnected{ playerid } = true;
OnPlayerConnect( playerid );
}
// do stuff ..
// don't forget to return 1/0
}
public OnPlayerRequestSpawn( playerid ) // Players that are in class selection during gmx/time out won't request a class upon reconnecting. That's why I use OnPlayerRequestSpawn.
{
if ( !g_IsFullyConnected{ playerid } )
{
g_IsFullyConnected{ playerid } = true;
OnPlayerConnect( playerid );
}
// do stuff ..
// don't forget to return 1/0
}