OnplayerDeath Killer ID Undefined
#1

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??
Reply
#2

What do u mean?

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

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

Reply
#4

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.
Reply
#5

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)