21.01.2015, 11:43
Please this is very improtant for me.....
First here is the codes that under onplayerdisconnect
btw SendToAdmin is a stock made by us ![Cheesy](images/smilies/biggrin.png)
And when the player disconnect from the server it apear at the console
This prevent me from saving any player data ![Sad](images/smilies/sad.gif)
Please Help
First here is the codes that under onplayerdisconnect
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME], PlayerIP[16];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerIp(playerid, PlayerIP, sizeof(PlayerIP));
if(reason == 0)
{
format(string, sizeof(string), "%s left the server (Timeout)", name);
SendToPlayers(COLOR_GRAY, string);
format(string, sizeof(string), "%s left the server (Timeout) (%s)", name, PlayerIP);
SendToAdmins(COLOR_GRAY, string);
}
else if(reason == 1)
{
format(string, sizeof(string), "%s left the server", name);
SendToPlayers(COLOR_GRAY, string);
format(string, sizeof(string), "%s left the server (%s)", name,PlayerIP);
SendToAdmins(COLOR_GRAY, string);
}
else
{
format(string, sizeof(string), "%s left the server (Kicked)", name);
SendToPlayers(COLOR_GRAY, string);
format(string, sizeof(string), "%s left the server (Kicked) (%s)", name, PlayerIP);
SendToAdmins(COLOR_GRAY, string);
}
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
INI_WriteInt(File,"Ban",PlayerInfo[playerid][pBan]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Police",PlayerInfo[playerid][pPolice]);
INI_WriteInt(File,"Freeze",PlayerInfo[playerid][pFreeze]);
INI_WriteInt(File,"Gang",PlayerInfo[playerid][pGang]);
INI_WriteInt(File,"Color", GetPlayerColor(playerid));
INI_WriteInt(File,"Armour", GetPlayerArmour(playerid));
INI_WriteInt(File,"Health", GetPlayerHealth(playerid));
INI_WriteInt(File, "Horseshoes", PlayerInfo[playerid][pHorseshoes]);
INI_WriteInt(File,"Ammo", GetPlayerAmmo(playerid));
INI_Close(File);
LoggedIn[playerid] = false;
return 1;
}
![Cheesy](images/smilies/biggrin.png)
And when the player disconnect from the server it apear at the console
PHP код:
[14:19:28] [debug] Run time error 4: "Array index out of bounds"
[14:19:28] [debug] Accessing element at index 1286240 past array upper bound 1
[14:19:28] [debug] AMX backtrace:
[14:19:28] [debug] #0 0001a38c in ?? (1286240) from FM.amx
[14:19:28] [debug] #1 0002230c in public Itter_OnPlayerDisconnect (0, 1) from FM.amx
[14:19:28] [debug] #2 native CallLocalFunction () from samp-server.exe
[14:19:28] [debug] #3 0001d990 in public S@@_OnPlayerDisconnect (0, 1, 33554432) from FM.amx
[14:19:28] [debug] #4 native CallLocalFunction () from samp-server.exe
[14:19:28] [debug] #5 0000d520 in ?? (0, 1) from FM.amx
[14:19:28] [debug] #6 000003d8 in public OnPlayerDisconnect (0, 1) from FM.amx
[14:19:28] [part] Nezoo has left the server (0:1)
![Sad](images/smilies/sad.gif)
Please Help
REP+++++