citizenfx / fivem

The source code for the Cfx.re modification frameworks, such as FiveM, RedM and LibertyM, as well as FXServer.
https://cfx.re/
3.48k stars 2.06k forks source link

Allow cancelling CEventNetworkEntityDamage to prevent damage #2343

Open mcNuggets1 opened 7 months ago

mcNuggets1 commented 7 months ago

What happened?

I would propose a way to disable taking damage for players, while not using SetEntityInvincible or similiar natives, as I'm trying to implement my own death state, that isn't as buggy as GTA's (with stopped networking etc).

Expected result

To stop a event

Reproduction steps

There are none, this is a suggestion, I hope, I can do these here.

Importancy

Unknown

Area(s)

FiveM, FXServer, OneSync, Natives

Specific version(s)

FiveM

Additional information

No response

blattersturm commented 7 months ago

Some implementation note: a server-side event handler would need a bit more advanced logic than just suppressing the event, as it'd also need a fake reply sent to the originating client.

Similarly, a damage callback for local damage could be curious, too, and seems to be what this person is requesting.

mcNuggets1 commented 7 months ago

I'm talking pure clientside.

What I'm requesting is a better way or any way to prevent the player from dying INSIDE the NetworkEntityDamage event or OTHER events or functions.

Players should not die in code on my server, I wanna do my own death system and have it network the ragdoll further (which stops when the player dies in many cases)

Gittified commented 7 months ago

I'd vote for the server-side event handler. Giving the client less control over stuff is a great idea considering the amount of cheaters etc.

Overall this is a good idea anyways.

mcNuggets1 commented 7 months ago

I'd vote for the server-side event handler. Giving the client less control over stuff is a great idea considering the amount of cheaters etc.

Overall this is a good idea anyways.

Why not both? Would be handy for networking stuff. I don't want huge delays in gameplay.

Mane48 commented 6 months ago

Dont know if this has still been looked at but this would be AMAZING to stop cheaters from creating unwanted damaged events to players!

If the logic server sided is tricky and if not weird then let it be it! As long as we can get something to play with things like that. It can open doors in regards to scripts that handle damage given to the player and anti-cheat scripts. But, I will say, it can not be done client side, if there is any such thing made that can cancel out damage client sided it will be ABUSED by cheaters, I wouldn't recommend such event existing for the client, solely just server sided.

mcNuggets1 commented 4 months ago

Dont know if this has still been looked at but this would be AMAZING to stop cheaters from creating unwanted damaged events to players!

If the logic server sided is tricky and if not weird then let it be it! As long as we can get something to play with things like that. It can open doors in regards to scripts that handle damage given to the player and anti-cheat scripts. But, I will say, it can not be done client side, if there is any such thing made that can cancel out damage client sided it will be ABUSED by cheaters, I wouldn't recommend such event existing for the client, solely just server sided.

Same opinion. It's a shame we cannot combat cheaters efficiently in this manner.