Crash on disconnect
#1

Hello people, long I haven't asked something here. Well, I've started a new project and got some problems.

-The whole server crashes when a player leaves/disconnects from my server.

I've the following code under OnPlayerDisconnect().
pawn Код:
public OnPlayerDisconnect(playerid,reason)
{
    new string[256];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    switch(reason)
    {
        case 0: format(string, sizeof(string), "[Leave] %s has left the server... (Timeout)", pName);
        case 1: format(string, sizeof(string), "[Leave] %s has left server... (Leaving)", pName);
        case 2: format(string, sizeof(string), "[Leave] %s has left server... (Kicked/Banned)", pName);
    }

    SendClientMessageToAll(COLOR_YELLOW, string);
    if (!dini_Exists(FileStats(playerid)))
    {
        dini_Create(FileStats(playerid));
    }
    SaveStats(playerid);

    if (PVeh[playerid] > 0)
    {
        DestroyVehicle(PVeh[playerid]);
        PVeh[playerid] = 0;
  }
  return 1;
}
Any possible way to fix it ?

Thanks,
Rafay.
Reply


Messages In This Thread
Crash on disconnect - by rafay - 30.05.2009, 11:24
Re: Crash on disconnect - by WrathOfGenesis - 30.05.2009, 12:34
Re: Crash on disconnect - by rafay - 30.05.2009, 15:51
Re: Crash on disconnect - by Gamer007 - 30.05.2009, 15:57
Re: Crash on disconnect - by rafay - 30.05.2009, 18:49

Forum Jump:


Users browsing this thread: 2 Guest(s)