Disabling Controls while doing emotes

Hello to everyone
This is my first topic since it is the first time i am having an issue
The problem i am facing is that i want to disable controls (ex firing a weapon, aiming) while i am doing an emote
This is the code for crossing hands emote

Citizen.CreateThread(function()
    local dict = "anim@amb@nightclub@peds@"
    
	RequestAnimDict(dict)
	while not HasAnimDictLoaded(dict) do
		Citizen.Wait(100)
	end
    local handsup = false
	while true do
		Citizen.Wait(0)
		if IsControlJustPressed(1, 47) then --Start holding g
            if not handsup then
                TaskPlayAnim(GetPlayerPed(-1), dict, "rcmme_amanda1_stand_loop_cop", 8.0, 8.0, -1, 50, 0, false, false, false)
                handsup = true
            else
                handsup = false
                ClearPedTasks(GetPlayerPed(-1))
            end
        end
    end
end)


function HaendeHoch()
	Citizen.CreateThread(function()
		if  HasAnimDictLoaded(dict) then
			Citizen.Wait(1)
			--DisableControlAction(0, 1, true) 				-- Disable pan
			--DisableControlAction(0, 2, true) 				-- Disable tilt
			DisableControlAction(0, 24, true) 				-- Attack
			DisableControlAction(0, 257, true) 				-- Attack 2
			DisableControlAction(0, 25, true) 				-- Aim
			DisableControlAction(0, 263, true) 				-- Melee Attack 1

			DisableControlAction(0, Keys['R'], true) 		-- Reload
			DisableControlAction(0, Keys['SPACE'], true) 	-- Jump
			DisableControlAction(0, Keys['TAB'], true) 		-- Select Weapon
			DisableControlAction(0, Keys['F'], true) 		-- Also 'enter'?

			DisableControlAction(0, Keys['F2'], true) 		-- Inventory
			DisableControlAction(0, Keys['F3'], true) 		-- Animations
			DisableControlAction(0, Keys['F5'], true) 		-- Bag
			DisableControlAction(0, Keys['F6'], true) 		-- Job & Panicbutton
			DisableControlAction(0, Keys['F7'], true) 		-- Billing
			DisableControlAction(0, Keys['F9'], true) 		-- Job

			--DisableControlAction(0, Keys['V'], true) 		-- Disable changing view
			--DisableControlAction(0, Keys['C'], true) 		-- Disable looking behind
			--DisableControlAction(2, Keys['P'], true)		-- Disable pause screen

			DisableControlAction(0, 59, true) 				-- Disable steering in vehicle
			--DisableControlAction(0, 71, true) 				-- Disable driving forward in vehicle
			--DisableControlAction(0, 72, true) 				-- Disable reversing in vehicle

			DisableControlAction(2, Keys['LEFTCTRL'], true) -- Disable going stealth

			DisableControlAction(0, 47, true)  				-- Disable weapon
			DisableControlAction(0, 264, true) 				-- Disable melee
			DisableControlAction(0, 257, true) 				-- Disable melee
			DisableControlAction(0, 140, true) 				-- Disable melee
			DisableControlAction(0, 141, true) 				-- Disable melee
			DisableControlAction(0, 142, true) 				-- Disable melee
			DisableControlAction(0, 143, true) 				-- Disable melee
			DisableControlAction(0, 75, true)  				-- Disable exit vehicle
			DisableControlAction(27, 75, true) 				-- Disable exit vehicle
		end
	end)
end

thanks for any help

Something like this should work

1 Like

thanks for the help however after i cross my hands i cant move any fix for that?

I thought that’s what you wanted… Remove this:

DisableControlAction(0, 32, true) -- W
DisableControlAction(0, 34, true) -- A
DisableControlAction(0, 31, true) -- S
DisableControlAction(0, 30, true) -- D
1 Like

sorry after i tested i see i cant get out of holding my arms if i press g again that is the problem