SA-MP Forums Archive
OnPlayerDeath problem - 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: OnPlayerDeath problem (/showthread.php?tid=405055)



OnPlayerDeath problem - zombieking - 05.01.2013

Hello, members of SA-MP Forums. I have the following code:

pawn Код:
new gunname[32], dName[MAX_PLAYER_NAME], rName[MAX_PLAYER_NAME];
        GetWeaponName(reason,gunname,sizeof(gunname));
        GetPlayerName(playerid,dName,MAX_PLAYER_NAME);
        GetPlayerName(killerid,rName,MAX_PLAYER_NAME);
        printf("%d,%d,%d",playerid,killerid,reason);
        format(string, sizeof(string), "Administrator Warning: %s has killed %s using %s.", rName, dName, gunname);
        SendClientMessage(playerid, -1, string);
And.. console output:
Код:
1,65535,255
1 - playerid ; 65535 - killerid ; 255 - reason (weapon id) - 255

In-game output:
Код:
. has killed [player name here] using .
Why is this happening and how to fix it?


Re : OnPlayerDeath problem - Alex83690 - 05.01.2013

put your code in :

PHP код:
if(killerid != INVALID_PLAYER_ID)
{
    
//your code
    
return 1;




Re: OnPlayerDeath problem - zombieking - 05.01.2013

Now it doesn't even output anything...


Re: OnPlayerDeath problem - zombieking - 05.01.2013

One more thing, the reason is always 255 no matter what weapon has been used or who has killed who...