[SOLVED] How did i use the DisableControlAction function?

Hi,
i have an issue because i want to DisableControlAction while the camera is active but it doesn’t work :sob:

here is my code :

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)

		if isCameraActive then
			DisableControlAction(0, 20, true) -- move (z)
			DisableControlAction(0, 44, true) -- move (q)
			DisableControlAction(0, 32, true) -- move (w)
			DisableControlAction(0, 33, true) -- move (s)
			DisableControlAction(0, 34, true) -- move (a)
			DisableControlAction(0, 35, true) -- move (d)
			DisableControlAction(0, 25, true) -- Input Aim
			DisableControlAction(0, 24, true) -- Input Attack

			local playerPed = GetPlayerPed(-1)
			local coords    = GetEntityCoords(playerPed)

			local angle = heading * math.pi / 180.0
			local theta = {
				x = math.cos(angle),
				y = math.sin(angle)
			}

			local pos = {
				x = coords.x + (zoomOffset * theta.x),
				y = coords.y + (zoomOffset * theta.y)
			}

			local angleToLook = heading - 140.0
			if angleToLook > 360 then
				angleToLook = angleToLook - 360
			elseif angleToLook < 0 then
				angleToLook = angleToLook + 360
			end

			angleToLook = angleToLook * math.pi / 180.0
			local thetaToLook = {
				x = math.cos(angleToLook),
				y = math.sin(angleToLook)
			}

			local posToLook = {
				x = coords.x + (zoomOffset * thetaToLook.x),
				y = coords.y + (zoomOffset * thetaToLook.y)
			}

			SetCamCoord(cam, pos.x, pos.y, coords.z + camOffset)
			PointCamAtCoord(cam, posToLook.x, posToLook.y, coords.z + camOffset)

			Alert("Press ~INPUT_VEH_FLY_ROLL_LEFT_ONLY~ and ~INPUT_VEH_FLY_ROLL_RIGHT_ONLY~ to turn the view")
		else
			Citizen.Wait(500)
		end
	end
end)

need help please :innocent: :pray: :pleading_face:

1 Like

hmm i fix it :smile:

i just disableAllControlAction and EnableControlAction that i wanted :smiley:

can you give your config?

you mean this ? :

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)

		if isCameraActive then

			DisableAllControlActions(0)
			EnableControlAction(0, 27, true)
			EnableControlAction(0, 175, true)
			EnableControlAction(0, 174, true)
			EnableControlAction(0, 173, true)
			EnableControlAction(0, 177, true)
			EnableControlAction(0, 322, true)
			EnableControlAction(0, 18, true)
			EnableControlAction(0, 22, true)

			local playerPed = GetPlayerPed(-1)
			local coords    = GetEntityCoords(playerPed)
				
			local angle = heading * math.pi / 180.0
			local theta = {
				x = math.cos(angle),
				y = math.sin(angle)
			}

			local pos = {
				x = coords.x + (zoomOffset * theta.x),
				y = coords.y + (zoomOffset * theta.y)
			}

			local angleToLook = heading - 140.0
			if angleToLook > 360 then
				angleToLook = angleToLook - 360
			elseif angleToLook < 0 then
				angleToLook = angleToLook + 360
			end

			angleToLook = angleToLook * math.pi / 180.0
			local thetaToLook = {
				x = math.cos(angleToLook),
				y = math.sin(angleToLook)
			}

			local posToLook = {
				x = coords.x + (zoomOffset * thetaToLook.x),
				y = coords.y + (zoomOffset * thetaToLook.y)
			}

			SetCamCoord(cam, pos.x, pos.y, coords.z + camOffset)
			PointCamAtCoord(cam, posToLook.x, posToLook.y, coords.z + camOffset)

			Alert("Press ~INPUT_VEH_FLY_ROLL_LEFT_ONLY~ and ~INPUT_VEH_FLY_ROLL_RIGHT_ONLY~ to turn the view") 
-- i was having an issue with "ESX.ShowNotification" so i replace it by the same but in the script"
		else
			Citizen.Wait(2000)
		end
	end
end)

i want to disable Q key on my server can you explain how can i do this?
Full Explain Pls

Just use

DisableControlAction(0, 44, true) 

In a Loop to prevent user from using Q