30.05.2009, 11:24
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().
Any possible way to fix it ?
Thanks,
Rafay.
-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;
}
Thanks,
Rafay.