14.09.2014, 14:33
Don't overload OnPlayerConnect callback with many functions. Delay it for safe calls.
pawn Код:
new
OPC_Timer[MAX_PLAYERS] = {-1, ...};
public OnPlayerConnect(playerid) {
if(OPC_Timer[playerid] == -1)
OPC_Timer[playerid] = SetTimerEx("SafeOnPlayerConnect", 300, false, "d", playerid);
else {
KillTimer(OPC_Timer[playerid]);
OPC_Timer[playerid] = -1;
OnPlayerConnect(playerid);
}
return 1;
}
forward SafeOnPlayerConnect(playerid);
public SafeOnPlayerConnect(playerid)
{
OPC_Timer[playerid] = -1; //Resetting the variable.
if(!IsPlayerConnected(playerid)) return 0; //If player has left before this getting called, stop going further then.
//Rest onplayerconnect codes here.
return 1;
}

