MineX server Posted June 22 Share Posted June 22 Hello, I'm developing an anti-cheat system in MTA:SA and I'm trying to detect players who block or cancel the `onClientPlayerDamage` event on their side, which prevents the server from detecting damage via `onPlayerDamage`. I know that if the client cancels `onClientPlayerDamage` using `cancelEvent()`, the server-side `onPlayerDamage` event will not be triggered. Resulting in godmode and players not dying So my question is: - Is there a reliable way to detect if the client-side damage event was cancelled? - Does MTA have an anti cheat against this type of cheating ? -Are there other ways for cheating to cancel damage taken and not die? Any suggestions or ideas to detect and prevent this kind of abuse would be appreciated! Thanks in advance. Link to comment
CastiaL Posted July 3 Share Posted July 3 function stopUnknownDamage(attacker, damagetype, bodypart) if (damagetype == 55) then --if the no known information about this damage type cancelEvent() --cancel the event end end addEventHandler("onClientPlayerDamage", localPlayer, stopUnknownDamage) Link to comment
Moderators IIYAMA Posted July 3 Moderators Share Posted July 3 On 22/06/2025 at 12:58, MineX server said: - Is there a reliable way to detect if the client-side damage event was cancelled? You might be able to detect it using: https://wiki.multitheftauto.com/wiki/WasEventCancelled Though I do not know if this functions works correctly for native events. Something you have to test yourself. Make sure to set the addEventHandler to low priority. Link to comment
CastiaL Posted July 4 Share Posted July 4 addEventHandler("onClientPlayerDamage", localPlayer, function() if wasEventCancelled() then --triggerServerEvent("cancelDetected", localPlayer) end end, false, -999) -- low priority Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now