SA-MP Forums Archive
OnPlayerTakeDamage bug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: OnPlayerTakeDamage bug (/showthread.php?tid=506392)



OnPlayerTakeDamage bug - Jefff - 12.04.2014

I got headshot system

pawn Код:
if((WEAPON_RIFLE <= GetPlayerWeapon(issuerid) <= WEAPON_SNIPER) && bodypart == 9)
{
    SetPlayerHealth(playerid, 0.0);
    return 0;
}
9 means head and if we connect everthing is working but after +/- 15 min if i shoot on his head player is killed with INVALID_KILLER_ID not my id reason 255, after another few minutes player have god mode so OnPlayerTakeDamage is not called? or GetPlayerWeapon or bodypart? its old samp bug, if i remeber its from 0.3x? for the first bug samp is not holding killerid if it looks like suicide.
Please fix this bug because why the sniper rifle is available when does not work


Re: OnPlayerTakeDamage bug - Kar - 12.04.2014

from 0.3z, use OnPlayerGiveDamage. That's not much of a difference now (with no lag shot, only difference is the given and taken differences)


Re: OnPlayerTakeDamage bug - PinEvil - 13.04.2014

Not a big difference, Due to the new update having no lag shot.


Re: OnPlayerTakeDamage bug - Jefff - 13.04.2014

but i want take not give, its serious bug and should be fixed


Re: OnPlayerTakeDamage bug - Kar - 13.04.2014

Why would you want TAKE for a sniper? just use GIVE, what difference do you want!?

GIVE with no lag shot works how you want it to work.

"9 means head and if we connect everthing is working but after +/- 15 min if i shoot on his head player is killed with INVALID_KILLER_ID not my id reason 255, after another few minutes player have god mode so OnPlayerTakeDamage is not called? or GetPlayerWeapon or bodypart? its old samp bug, if i remeber its from 0.3x? for the first bug samp is not holding killerid if it looks like suicide."

also this seems partially on your side, my server has been up for 3 days and headshots are working FINE with TAKE

also your using setplayerhealth so its not +/- 15 minutes, its due to LAG.

Make a custom death system that tracks the last bodypart / weapon and attacker if you want your reason and killerid to relay to onplayerdeath with SetPlayerHealth(playerid, 0.0);


Re: OnPlayerTakeDamage bug - Jefff - 15.04.2014

Quote:
Originally Posted by Kar
Посмотреть сообщение
also your using setplayerhealth so its not +/- 15 minutes, its due to LAG.
I dont think so because on other servers is the same, after maybe 1h online sniper rifle is useless ( doesnt do damage )
so there is no chance to kill others in OnPlayerGiveDamage too, only way - both relog and everything is ok for another bug

Quote:
Originally Posted by Kar
Посмотреть сообщение
Make a custom death system that tracks the last bodypart / weapon and attacker if you want your reason and killerid to relay to onplayerdeath with SetPlayerHealth(playerid, 0.0);
better to wait until this will be fixed


Re: OnPlayerTakeDamage bug - Kar - 15.04.2014

to fix what? if you use setplayerhealth the killerid should be invalid


edit:-

I only suggested the use of GIVE damage because of him apparently stating that TAKE damage was bugging out after -/+ 15 minutes (which is more or less your script's FAULT.)


Re: OnPlayerTakeDamage bug - cessil - 15.04.2014

here's the usual order of the function calls
OnPlayerWeaponShot
OnPlayerGiveDamage
OnPlayerTakeDamage

although sometimes weaponshot and givedamage can get mixed up, onplayertake damage will be called last
if you have code in givedamage, that is before take damage is called then the player getting shot has not yet been shot

so killing the player in onplayergivedamage will be purely because of the script, do what kar suggested with the tracking of the person that last shot them which could be in onplayerweaponshot and then under onplayerdeath if its an unknown killerid then set it to the last person that shot them

this is not a bug


Re: OnPlayerTakeDamage bug - Lordzy - 15.04.2014

Just assign the player who damages the other player to be the last player who have damaged. When you're using SetPlayerHealth to kill, check the intervals and determine the killer's id with the assigned ID.

EDIT : late..


Re: OnPlayerTakeDamage bug - Jefff - 15.04.2014

Quote:
Originally Posted by cessil
Посмотреть сообщение
here's the usual order of the function calls
OnPlayerWeaponShot
OnPlayerGiveDamage
OnPlayerTakeDamage

although sometimes weaponshot and givedamage can get mixed up, onplayertake damage will be called last
if you have code in givedamage, that is before take damage is called then the player getting shot has not yet been shot

so killing the player in onplayergivedamage will be purely because of the script, do what kar suggested with the tracking of the person that last shot them which could be in onplayerweaponshot and then under onplayerdeath if its an unknown killerid then set it to the last person that shot them

this is not a bug
I know but the player shoots himself on my screen so this is a critical bug, for headshot system your sugestion is good but why in OnPlayerTakeDamage issuerid is INVALID_KILLER_ID but is not? :P i got
if(0 <= issuerid < MAX_PLAYERS) then rest of headshot code, its still a bug not on my side, and what about other skin parts? player have permanently god mode for sniper rifle

step by step
we connect with friend
only sniper rifle duels
headshot works perfectly
after some time i shoot on his head or he on my and i died with INVALID_KILLER_ID but he shoots me so why SetPlayerHealth is using INVALID_KILLER_ID ?
after another 2-3 kills with INVALID_KILLER_ID we get this bug both and now we cant get damage together with sniper rifle ( total god for all skin and I see hes shooting for himself because blood is going down from his skin)
after relog (both) everything is working good for another few minutes/hours

its not only on my server so this is serious bug for only sniper rifle