# Disabling combat rolling and weapon quick-swapping

> Stop combat rolling and weapon quick-swapping in FiveM PvP: the exact control IDs, a 0.00 ms client script, SetPedCanSwitchWeapon and a roll cooldown.

Source: https://fam-tools.com/guides/fivem-disable-combat-roll-quickswap · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 8 min

**Short answer.** The combat roll is the jump control (22) pressed while aiming (25). Disable 22 while the player is aiming or free-aiming. Quick swap uses the weapon slot keys 1–9 (controls 157–165) and the scroll wheel (14–17); disable those, or call `SetPedCanSwitchWeapon(ped, false)` while shooting. Run the loop every frame only while armed so idle cost stays at 0.00 ms.

## Key points

- Roll = **22** (jump) while **25** (aim) is held.
- Slot keys 1–9 = controls **157–165**; wheel/scroll = **14–17**; Tab wheel = **37**.
- `DisableControlAction` must run every frame to stay active.
- Sleep the loop when the player is unarmed.

Combat rolling while aiming and instantly swapping weapons with the number keys are fine in GTA Online but break roleplay gunfights and competitive PvP balance. Both are just game controls, so a short client loop can switch them off — or limit them — without touching anything else.

## The controls involved

| ID | Control | Default key |
| --- | --- | --- |
| 14 / 15 | `INPUT_WEAPON_WHEEL_NEXT` / `PREV` | Mouse wheel (while wheel open) |
| 16 / 17 | `INPUT_SELECT_NEXT_WEAPON` / `PREV` | Mouse wheel |
| 22 | `INPUT_JUMP` | Space |
| 24 | `INPUT_ATTACK` | Left mouse |
| 25 | `INPUT_AIM` | Right mouse |
| 37 | `INPUT_SELECT_WEAPON` | Tab (weapon wheel) |
| 157–165 | `INPUT_SELECT_WEAPON_UNARMED` … `SNIPER` | 1–9 |

## Disabling the combat roll

*client.lua*

```lua
CreateThread(function()
    while true do
        local sleep = 500
        local ped = PlayerPedId()
        if IsPedArmed(ped, 4) then
            sleep = 0
            if IsControlPressed(0, 25) or IsPlayerFreeAiming(PlayerId()) then
                DisableControlAction(0, 22, true)
            end
        end
        Wait(sleep)
    end
end)
```

`IsPedArmed(ped, 4)` checks for firearms only (1 = melee, 2 = explosives), so the loop sleeps while the player carries nothing that can roll.

## Disabling quick swap

*client.lua — block slot keys and scroll switching*

```lua
local SWAP = { 14, 15, 16, 17, 157, 158, 159, 160, 161, 162, 163, 164, 165 }

CreateThread(function()
    while true do
        local sleep = 500
        if IsPedArmed(PlayerPedId(), 4) then
            sleep = 0
            for i = 1, #SWAP do
                DisableControlAction(0, SWAP[i], true)
            end
        end
        Wait(sleep)
    end
end)
```

If your inventory equips weapons from hotbar slots (ox_inventory, qb-inventory), the number keys are usually already taken by the inventory and the game’s own slot keys are disabled — check before adding this. To remove the Tab weapon wheel entirely, see [disabling the weapon wheel](https://fam-tools.com/guides/fivem-disable-weapon-wheel).

> **Only while shooting** — Some servers allow swapping but not mid-fight: call `SetPedCanSwitchWeapon(PlayerPedId(), false)` while `IsPedShooting` or aiming, and `true` again a second later.

## A roll cooldown instead of a ban

A softer rule: allow one roll every few seconds. Detect the jump press while aiming, then disable it for a cooldown.

*client.lua — one roll every 3 seconds*

```lua
local nextRoll = 0

CreateThread(function()
    while true do
        local sleep = 500
        if IsPedArmed(PlayerPedId(), 4) then
            sleep = 0
            if IsControlPressed(0, 25) then
                if GetGameTimer() < nextRoll then
                    DisableControlAction(0, 22, true)
                elseif IsControlJustPressed(0, 22) then
                    nextRoll = GetGameTimer() + 3000
                end
            end
        end
        Wait(sleep)
    end
end)
```

## Questions

### How do I disable combat rolling in FiveM?

Disable control 22 (jump) every frame while the player aims (control 25) or is free-aiming.

### Which control IDs switch weapons?

157–165 for the number keys, 14–17 for wheel and scroll switching and 37 for the Tab weapon wheel.

### Why does my disable script not work?

`DisableControlAction` lasts one frame. It must run in a loop with `Wait(0)` while it should be active.

### Will this cost performance?

Barely, if the loop sleeps while the player is unarmed. Check it in resmon.

## Related

- https://fam-tools.com/guides/fivem-disable-weapon-wheel
- https://fam-tools.com/guides/fivem-first-person-aiming
- https://fam-tools.com/guides/fivem-recoil-script
- https://fam-tools.com/guides/fivem-headshot-damage-settings
