-
-
Notifications
You must be signed in to change notification settings - Fork 486
New event onDamageEventCancelled #4384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
New event onDamageEventCancelled #4384
Conversation
Would be great to be able to customise this event through setServerConfigSetting.
Additionally, each type (player/ped/vehicle) should have own cooldown. Otherwise, with simple glue resource you will be lacking some of the reported data. |
Three new settings have been added in mtaserver.conf:
Additionally, the interval is now checked per element, rather than globally since the last damage to a vehicle or ped. |
It seems like a terrible idea to add even more events that get triggered by scripting. |
The current event system is terrible, that’s true, and I also have it on my list. I could also add an option in mtaserver.conf to completely disable this event. |
I think this is a good idea to add new server config option to disable it. Many projects cancel damage events by default (to implement custom damage system). So avoiding unnecessary overhead from this event will be useful. |
This PR adds a new event:
onDamageEventCancelled
.resourceName - The name of the resource in which the event was cancelled.
The event is triggered when a client cancels (via
cancelEvent
) events such asonClientPedDamage
,onClientPlayerDamage
, andonClientVehicleDamage
.The source of the event is the source of the packet, i.e. the client where the event was cancelled.
1. Why?
It’s meant to help fight cheats related to godmode. Cheaters using executors either call
setElementHealth
on the localPlayer (for example inonClientRender
- this soon can be blocked through PR #4376), or they cancel damage events such asonClientPedDamage
oronClientPlayerDamage
. I’m not entirely sure whether this event will be useful for vehicles - if not, it can be removed fromonClientVehicleDamage
.2. Unnecessary packet sending / event flood
That’s why there’s an interval - one packet per second. This interval can be increased if one second is too short. The goal is mainly to prevent massive spam, e.g. when a player is on fire and takes constant damage. In one “cycle” of burning, the event is triggered exactly six times with the current interval. Maybe it should be increased?
For the same reason, the event is not triggered while a player is drowning. When oxygen drops to zero, the game attempts to subtract HP every frame, which would otherwise cause event flooding and unnecessary packet spam.
3. This doesn’t solve the problem
That’s true - this is not a direct fix for cheats. But we need to take into account that a huge portion of cheats aren’t memory modifications. They’re malicious Lua code executed through Lua executors. That’s exactly what cheaters use to modify vehicle handling, weapon properties, or to enable godmode.