SA-MP Forums Archive
OnplayerDeath Killer ID Undefined - 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 Killer ID Undefined (/showthread.php?tid=612453)



OnplayerDeath Killer ID Undefined (Onplayerweaponshot return 0;) - PRoleplay - 18.07.2016

I'm using custom Damage Script to avoid Sprunkguard Cheat
on my OnplayerWeaponshot i return 0; to avoid default damage then i set the target hp manually depends on Gun ID

So here's the problem, on my onplayerdeath killer id is undefined, ( ithink it cause my onplayerweaponshot return 0)
so the default Program can't detect killer id

any suggestion to fix this??


Re: OnplayerDeath Killer ID Undefined - WhiteGhost - 18.07.2016

What do u mean?

Also,have a look at https://sampwiki.blast.hk/wiki/OnPlayerDeath


Re: OnplayerDeath Killer ID Undefined - PRoleplay - 18.07.2016

When i tried to car ram it detects the killerid
but when i try to kill target using gun
it can't detect the killer id

maybe this cause my problem

PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
       
i sethpmanually code here  then return 0to avoid default damage
       
return 0;// i think this one is the cause of the issue, but if i removed this, my server side damage will mess up




Re: OnplayerDeath Killer ID Undefined - Threshold - 18.07.2016

Because they're not being killed by the player, they're being killed by the server setting their HP to 0 or below... so there IS no killerid. You need a player variable that stores the player ID of the last person that shot them and use that as a killerid under OnPlayerDeath.

You'll need to exclude the killerid depending on the death reason.


Re: OnplayerDeath Killer ID Undefined - PrO.GameR - 18.07.2016

Just void any OnPlayerDeath with reason 255 and call it yourself when you kill someone with your custom dmg.


Re: OnplayerDeath Killer ID Undefined - GangstaSunny - 18.07.2016

PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    
//stuff
    
if(hitid != INVALID_PLAYER_ID){SetPVarInt(hitid"LastHittedFrom"playerid);}
    return 
0;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    if(
GetPVarInt(playerid,"LastHittedFrom") != INVALID_PLAYER_ID)){killerid GetPVarInt(playerid,"LastHittedFrom");}
    
    
//stuff

Should work.