SA-MP Forums Archive
Crash on disconnect - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Crash on disconnect (/showthread.php?tid=79685)



Crash on disconnect - rafay - 30.05.2009

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.


Re: Crash on disconnect - WrathOfGenesis - 30.05.2009

Could be a prob with SaveStats. Can we see it please?


Re: Crash on disconnect - rafay - 30.05.2009

This thread can die off.


Re: Crash on disconnect - Gamer007 - 30.05.2009

The guy asked you for the code, No code no solutions.


Re: Crash on disconnect - rafay - 30.05.2009

The problem is solved, that's why I said so.