Add onPedHit event - #5179
Open
FileEX wants to merge 3 commits into
Open
Conversation
Contributor
|
a bit offtopic but yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new server-side
onPedHitevent, which is triggered when a ped/player is hit by another player/ped with a melee weapon, a physical weapon attack (such as hitting with a rifle butt), or a vehicle.Motivation
The main purpose of this event is to make it easier to detect god mode cheats. For firearms, we can use
onPlayerWeaponFireon the server side to check whether the player actually took damage. For projectiles, we can useonPlayerProjectileCreation, and for the fire extinguisher and spray can, we haveisPedChoking. However, there is currently no way to check whether a player was hit by a melee attack.With god mode cheats, the
onPedDamageevent isn't triggered because the server keeps receiving the same HP value from the client. This event will allow us to check whether the player actually took damage after being hit.I know it's still not perfect and can be bypassed, but if an
onElementHealthChangeevent is added someday, there will be no way to bypass it, because even clever tricks like changing the HP in a timer would still be easily detectable on the server side.Test plan
Checklist