PDA

View Full Version : OnPlayerGiveDamage


audriuxxx
20/05/2014, 04:11 AM
Hi,

I want to ask.

1. When somebody do damage to somebody then always this callback get called right?
2. It'is possible, that this callback will be called later after when damage was did? i mean player HP change, and after some seconds this callback get's called

nmader
20/05/2014, 04:15 AM
1) Yes, each time a player reduces another player's healh.
2) Your wording for this question is unusual, could you reword it?

audriuxxx
20/05/2014, 04:18 AM
I mean it'is possible that this callback can be called later after shoot?

SickAttack
20/05/2014, 04:19 AM
1 - Yes.
2 - Yes, if your attempting to make an anti health hacks system with this then you will have problems with the player lagging.

PaulDinam
20/05/2014, 04:23 AM
You can't, this callback is called every time a player gives damage to another player in any kind of way.

audriuxxx
20/05/2014, 04:23 AM
Then how to avoid this? yes am doing anti-cheat, and i very important i need in this callback getplayerhealth and then it'is important that player HP after some time change. Because you know if you get player health in this callback you get HP how much player have now. And after some time HP get changes, by amount.

PaulDinam
20/05/2014, 04:27 AM
Then make a timer between each shot,I can barely understand you.

SickAttack
20/05/2014, 04:28 AM
Heres an example on how to prevent this: http://forum.sa-mp.com/showthread.php?t=513907.

Threshold
20/05/2014, 10:32 AM
There is OnPlayerGiveDamage, called when a player physically hurts another player through the use of weapons etc.

Then there is OnPlayerTakeDamage, called whenever a player is physically damaged, whether it be through falling, explosions, vehicles etc.
I think you may be looking for the second option.

SickAttack
20/05/2014, 11:45 PM
There is OnPlayerGiveDamage, called when a player physically hurts another player through the use of weapons etc.

Then there is OnPlayerTakeDamage, called whenever a player is physically damaged, whether it be through falling, explosions, vehicles etc.
I think you may be looking for the second option.

Wrong, use OnPlayerGiveDamage...

Ramoboss
21/05/2014, 12:48 AM
if you want to make an Anti-Cheat, then try to use the callback OnPlayerUpdate ^^

Threshold
21/05/2014, 01:55 AM
Wrong, use OnPlayerGiveDamage...

How am I 'wrong'?
Both callbacks handle 'issuerid'...

Lordzy
21/05/2014, 07:20 AM
Since 0.3z, the callbacks are called in such an order:

- OnPlayerWeaponShot - This is called first whenever a player shoots.
- OnPlayerGiveDamage - OnPlayerGiveDamage is being called when player gives damage. It gets called for the player when that player damages other player in-game. It doesn't mean that the damage had been received by the other player.
- OnPlayerTakeDamage - This is called whenever the player takes damage or when a damage is received. There can be a chance where HP may not be changed but through my experiences using this callback, it's always called when player takes damage or when a hit is synchronized.

If you're thinking about anti-health cheats, you must also make sure that HP related functions are always hooked. Otherwise you might encounter false detections.

audriuxxx
21/05/2014, 02:07 PM
It doesn't mean that the damage had been received by the other player. How to understand it? i mean, that sometimes, player can not lose HP? maybe just need to check if amount is bigger then amount > 1, then check?