NPC keeps geting score - 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: NPC keeps geting score (
/showthread.php?tid=270410)
NPC keeps geting score -
cruising - 20.07.2011
Hello!
My NPC keeps getting score of other players kills/deaths.
The NPC has ID 0.
So if you dies in a car/flight crash or kill your self the NPC get score, even if you get rocket launched by a player when you sitting in a vehicle. Im pretty tired of this and i want a solution of this problem.
Anyone who can help with this or explain why it is like it is?
Re: NPC keeps geting score -
[MG]Dimi - 20.07.2011
Post code under callback OnPlayerDeath
Re: NPC keeps geting score -
cruising - 20.07.2011
Quote:
Originally Posted by [MG]Dimi
Post code under callback OnPlayerDeath
|
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPVarInt(playerid, "nearExp") > -1 && killerid == INVALID_PLAYER_ID) {
killerid = GetPVarInt(playerid, "nearExp");
if(killerid == playerid) killerid = INVALID_PLAYER_ID;
reason = 51;
}
SendDeathMessage(killerid, playerid, reason);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
return 1;
}