Saving Kills/deaths Issue - 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)
+--- Thread: Saving Kills/deaths Issue (
/showthread.php?tid=289560)
Saving Kills/deaths Issue -
Gtarokerzz - 12.10.2011
Hello,
I have a problem in my script.It doesnt saves players kills and deaths when they disconnect or server gets restart.
It shows 0 kills and deaths when they come again i want it to save anyone please help.
Код:
public OnPlayerDisconnect(playerid, reason)
{
#if Leavemessages
new PlayerName[30], string[256];
switch (reason)
{
case 0:
{
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, 256, "%s has left the server (Timeout)", PlayerName);
SendClientMessageToAll(leavemessagecolor, string);
}
case 1:
{
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, 256, "%s has left the server (Leaving)", PlayerName);
SendClientMessageToAll(leavemessagecolor, string);
}
case 2:
{
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(string, 256, "%s has left the server (Kicked/banned)", PlayerName);
SendClientMessageToAll(leavemessagecolor, string);
}
}
TextDrawHideForPlayer(playerid,TotalStats[playerid]);
PlayerInfo[playerid][pDeaths]=0;
PlayerInfo[playerid][pKills]=0;
#endif
}
Please anyone fix it !
Re: Saving Kills/deaths Issue -
Kush - 12.10.2011
Maybe because you set the values to 0 upon disconnect?
PHP код:
PlayerInfo[playerid][pDeaths]=0;
PlayerInfo[playerid][pKills]=0;
Remove it...
Re: Saving Kills/deaths Issue -
Yamoo - 12.10.2011
OnPlayerDeath -
pawn Код:
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
This will give the person their kill or death
and
pawn Код:
PlayerInfo[playerid][pDeaths]=0;
PlayerInfo[playerid][pKills]=0;
??
Post your files - for like registered users example;
pawn Код:
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]
If you even have it which you should do as your character should be saved.
Re: Saving Kills/deaths Issue -
Gtarokerzz - 12.10.2011
Still 0 Anyone help plz
Re: Saving Kills/deaths Issue -
Yamoo - 12.10.2011
Read the above - which I posted.