Skip to content

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

FileEX
Copy link
Member

@FileEX FileEX commented Aug 22, 2025

This PR adds a new event: onDamageEventCancelled.

element attacker, element damagedEntity, int weapon, float damage, string resourceName

resourceName - The name of the resource in which the event was cancelled.

The event is triggered when a client cancels (via cancelEvent) events such as onClientPedDamage, onClientPlayerDamage, and onClientVehicleDamage.

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 in onClientRender - this soon can be blocked through PR #4376), or they cancel damage events such as onClientPedDamage or onClientPlayerDamage. I’m not entirely sure whether this event will be useful for vehicles - if not, it can be removed from onClientVehicleDamage.

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.

@FileEX FileEX closed this Aug 22, 2025
@FileEX FileEX reopened this Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant