txAdmin icon indicating copy to clipboard operation
txAdmin copied to clipboard

[BUG] Can shoot weapons while in noclip if previously equipped with a weapon

Open cesarmr-github opened this issue 6 months ago • 4 comments

txAdmin/FXServer versions: txAdmin v8.0.1 | FXServer b16276 (Ptero panel)

Describe the bug When in noclip mode, if you had a weapon equipped beforehand, you can still shoot even though it shouldn’t be allowed.

To Reproduce

Equip a weapon.

Activate noclip mode.

Try to shoot.

You will notice the character can still shoot despite being in noclip.

Expected behavior When noclip is activated, the character should not be able to shoot weapons regardless of whether a weapon was equipped before.

Screenshots (I don’t have screenshots but can provide if needed.)

Additional context This happens on a server running on Pterodactyl with FXServer version b16276.

cesarmr-github avatar Jul 03 '25 13:07 cesarmr-github

Seems like DisablePlayerFiring() could be used, but that would need to be called every frame.
Can someone please check if there are better options?
And could someone please also test it on RedM?

diff --git a/resource/menu/client/cl_player_mode.lua b/resource/menu/client/cl_player_mode.lua
--- a/resource/menu/client/cl_player_mode.lua
+++ b/resource/menu/client/cl_player_mode.lua
@@ -165,6 +165,7 @@
         Citizen.CreateThread(function()
             while IsFreecamActive() do
                 setLocallyInvisibleFunc(ped, true)
+                DisablePlayerFiring(ped, true)
                 if freecamVeh > 0 then
                     if DoesEntityExist(freecamVeh) then
                         setLocallyInvisibleFunc(freecamVeh, true) -- only works for players in RedM, but to prevent errors.

tabarra avatar Jul 04 '25 02:07 tabarra

A few have pointed out on discord that they like to be able to shoot while on noclip.
So I don't know about fixing this "bug".

tabarra avatar Jul 04 '25 21:07 tabarra

I dont have RedM. (I have fivem)

cesarmr-github avatar Jul 05 '25 11:07 cesarmr-github

You might be able to use: local ped = PlayerPedId() NetworkSetFriendlyFireOption(false) SetCanAttackFriendly(ped, false, false) SetPedConfigFlag(ped, 122, true)

DRAIKDev avatar Jul 12 '25 20:07 DRAIKDev