/stats > deaths never changes - 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: /stats > deaths never changes (
/showthread.php?tid=442709)
/stats > deaths never changes -
Sellize - 08.06.2013
---------- fixed
When I type /stats my deaths is 1 but when i do /kill and after i respawn do /stats again its still 1
How do I fix this?
Re: /stats > deaths never changes -
ReVo_ - 08.06.2013
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[playerid][pAlive] = 0;
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
return 1;
}
killerid if you do /kill is INVALID_PLAYER_ID and it's out of bounds of the array.
So do:
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[playerid][pAlive] = 0;
if (IsPlayerConnected(killerid)) //
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
return 1;
}
Re: /stats > deaths never changes -
Facerafter - 08.06.2013
I copy from SA-MP Wiki,
pawn Код:
Image:32px-Circle-style-warning.png Important Note: You MUST check whether killerid equals INVALID_PLAYER_ID before using it in an array, as it will cause the script to stop. See example above.
Image:32px-Ambox_warning_orange.png Note: You do not need to check whether killerid is INVALID_PLAYER_ID before using it in SendDeathMessage. INVALID_PLAYER_ID is a valid killerid ID parameter in that function.
Source:
https://sampwiki.blast.hk/wiki/OnPlayerDeath
I don't think it will solve it. But it's neccesary.
AW: /stats > deaths never changes -
HurtLocker - 08.06.2013
It seems that the onplayerdeath callback does not get triggered when you die. I had the same problem and in order to solve this I united the gamemode with the reg/log filterscript. In gamemode the onplayerdeath works fine.
Re: /stats > deaths never changes -
Sellize - 09.06.2013
Thanks guys, indeed killerid is unknown in /kill