'SetWeaponsNoAutoswap' native does not work

The SetWeaponsNoAutoswap native does not work.

  1. Client: Production, build number: 2699: FXServer Version: FXServer-master SERVER v1.0.0.7290 win32
  2. Expectance: Disable switching weapon to WEAPON_UNARMED or other weapons once rifle runs out of ammo.
  3. What actually happens: Literally nothing. Weapon still switches.
  4. Category of bug:native, weapons(?)
  5. Reproducible steps:
    Create a new resource.
    inside the client.lua script add this:
Citizen.CreateThread(function()
  while true do
      SetPedConfigFlag(ped, 48, true)
      SetWeaponsNoAutoswap(true)
      Citizen.Wait(0)
  end
end)

Get a weapon.
shoot until you run out of ammo.
The weapon is automatically unequipped.

Please help! Idk if this is a bug or an issue in my script.

You shouldnt need to loop over it, this should suffice:

CreateThread(function()
    SetWeaponsNoAutoswap(true)
end)

Tried this too, still does not work

This is what qb-weapons uses, you may have something else conflicting with the behavior.

does anyone have any ideas? i have no other scripts interfering with the behaviour :confused:
buuump

I just tried without looping and it worked just how I expected. Can you try on latest gamebuild / artifacts ?