OnPlayerGiveDamage
#1

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

1) Yes, each time a player reduces another player's healh.
2) Your wording for this question is unusual, could you reword it?
Reply
#3

I mean it'is possible that this callback can be called later after shoot?
Reply
#4

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

You can't, this callback is called every time a player gives damage to another player in any kind of way.
Reply
#6

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

Then make a timer between each shot,I can barely understand you.
Reply
#8

Heres an example on how to prevent this: https://sampforum.blast.hk/showthread.php?tid=513907.
Reply
#9

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

Quote:
Originally Posted by BenzoAMG
View Post
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...
Reply
#11

if you want to make an Anti-Cheat, then try to use the callback OnPlayerUpdate ^^
Reply
#12

Quote:
Originally Posted by SickAttack
View Post
Wrong, use OnPlayerGiveDamage...
How am I 'wrong'?
Both callbacks handle 'issuerid'...
Reply
#13

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)