SA-MP Forums Archive
Is there any situation in which OnPlayerGiveDamage is called but OnPlayerTakeDamage is not? - 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: Is there any situation in which OnPlayerGiveDamage is called but OnPlayerTakeDamage is not? (/showthread.php?tid=397967)



Is there any situation in which OnPlayerGiveDamage is called but OnPlayerTakeDamage is not? - Gryphus One - 07.12.2012

Hi, I think that more or less I know a bit of what the difference between these two callbacks is, and generally I tend to use OnPlayerTakeDamage in my scripts rather than the other callback. However, my doubt comes because I don't know if there are any particular situations in which OnPlayerGiveDamage is called while OnPlayerTakeDamage is not. For example I don't know if OnPlayerGiveDamage may be called when shooting a player of your own team (while team damage is disabled), or when you shoot to another player without lag-aiming (I mean when you see that green marker over him, but he's not actually receiving your shots).
I have read the wiki article: https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage which gives some tips about this, but still I don't have it fully clear.


Re: Is there any situation in which OnPlayerGiveDamage is called but OnPlayerTakeDamage is not? - park4bmx - 07.12.2012

its all due becouse of lag.
one 1 players screen he will shoot which will call OnPlayerGiveDamage but on the other player if they are lagging then OnPlayerTakeDamage will not get called because they never received the Damage to them nothing happened.

As it says its better to trust the client that its being damaged rather then the other way around..
So its really tricky to play with those two.


Respuesta: Is there any situation in which OnPlayerGiveDamage is called but OnPlayerTakeDamage is not? - Gryphus One - 08.12.2012

By the way, do you know if OnPlayerGiveDamage is called when you attack a player that has health hack/toggle?


Re: Respuesta: Is there any situation in which OnPlayerGiveDamage is called but OnPlayerTakeDamage is not? - SuperViper - 08.12.2012

Quote:
Originally Posted by Gryphus One
View Post
By the way, do you know if OnPlayerGiveDamage is called when you attack a player that has health hack/toggle?
Nope it doesn't, that's what makes it virtually impossible to detect godmode.


Re: Respuesta: Is there any situation in which OnPlayerGiveDamage is called but OnPlayerTakeDamage is not? - PlayLSX_Founder - 08.12.2012

Quote:
Originally Posted by SuperViper
View Post
Nope it doesn't, that's what makes it virtually impossible to detect godmode.
If it isn't called, surely you can use that to your advantage when you know the player should be taking damage?


Respuesta: Re: Respuesta: Is there any situation in which OnPlayerGiveDamage is called but OnPlayerTakeDamage is not? - Gryphus One - 08.12.2012

Quote:
Originally Posted by PlayLSX_Founder
View Post
If it isn't called, surely you can use that to your advantage when you know the player should be taking damage?
I don't quite understand this: how can you know that a player should be taking damage, and that you aren't just failing at shooting him?


Re: Is there any situation in which OnPlayerGiveDamage is called but OnPlayerTakeDamage is not? - PlayLSX_Founder - 08.12.2012

Players can take damage a multitude of ways, is OnPlayerDamage only called through weapon use? If not then you could use a command on suspected God Mode users to create damage for them, if OnPlayerDamage isn't called then you would know for sure they are invincible/desync, either way I think there is possiblity to use a disadvantage to your advantage


Re: Is there any situation in which OnPlayerGiveDamage is called but OnPlayerTakeDamage is not? - Azazelo - 09.12.2012

Quote:
Originally Posted by PlayLSX_Founder
View Post
Players can take damage a multitude of ways, is OnPlayerDamage only called through weapon use?
When player fall or velocity z set to -0.5 call OnPlayerDamage i think also to exist possibility to detect this.