DisableAllControlActions

Hello to everyone! I want to disable all control actions with a function! I tried with DisableAllControlActions(0) but its not working!

You have to loop over it every frame.

what do you mean?

He is meaning yo need to do a thread, and put the function in a while

Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local nearbyObject, nearbyID

	for i=1, #weedPlants, 1 do
		if GetDistanceBetweenCoords(coords, GetEntityCoords(weedPlants[i]), false) < 1 then
			nearbyObject, nearbyID = weedPlants[i], i
		end
	end

	if nearbyObject and IsPedOnFoot(playerPed) then

		if not isPickingUp then
			ESX.ShowHelpNotification(_U('weed_pickupprompt'))
		end

		if IsControlJustReleased(0, Keys['E']) and not isPickingUp then
			isPickingUp = true

			ESX.TriggerServerCallback('esx_illegal:canPickUp', function(canPickUp)

				if canPickUp then
					TaskStartScenarioInPlace(playerPed, 'world_human_gardener_plant', 0, false)

					Citizen.Wait(2000)
					while IsEntityPlayingAnim(playerPed, 'world_human_gardener_plant', 0, false) do
					ClearPedTasks(playerPed)
					    Citizen.Wait(1500)
					    DisableAllControlActions(0)
					end

	
					ESX.Game.DeleteObject(nearbyObject)
	
					table.remove(weedPlants, nearbyID)
					spawnedWeeds = spawnedWeeds - 1
	
					TriggerServerEvent('esx_illegal:pickedUpCannabis')
				else
					ESX.ShowNotification(_U('weed_inventoryfull'))
				end

				isPickingUp = false

			end, 'cannabis')
		end

	else
		Citizen.Wait(500)
	end

end

end)

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

	if canPickUp then
		DisableAllControlActions(0)
	else
		Citizen.Wait(1500)
	end
end

end)

Like this?

Try this

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
	    if isPickingUp then
	    	DisableAllControlActions(0)
        end
    end
end)

Thank you its working but not for all keys! i can press M and enter
and i want to disable them!Actually M is vMenu and i want to disable for that moment because there is a bug with saved character to skip animation

Okay, let’s see…

Following this DISABLE_CONTROL_ACTION I think we can do something like this

You can see all key codes here Controls

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
	    if isPickingUp then
	    	DisableAllControlActions(0)
            -- Add here your custom control action
            DisableControlAction(1, 244, true) -- M button
        end
    end
end)

nop…its not working! The prolem is vMenu i did this already before and with function but it didnt work…!So i dont know what to do

Well… But, only admins can use vMenu, right? So, you don’t really must care about that

No civilians have access with donate to MP Ped!Anyway thnx for your time i will find a solution i think

Okay, if you need more help, you can PM me

Hey, did you find any solutions for disabling “M” from vMenu yet?