Hi, I can’t seem to get the DisableControlAction(0, 0,true) working. Im trying to use it in a code where you farm. Im setting it up so you can farm 10x at a time but im trying to make it so you can’t both farm the 10x and the normal 1x but i can’t get it working so now im here asking for help
Hello, this is a friendly reminder because this is your first time creating a topic (or it has been a while since your last topic) in this category.
Please note that most of the support is provided by the FiveM community on a voluntary basis. We ask you to be patient; there is no guarantee we have a solution to your problem(s). To avoid unnecessary/duplicate topics, please browse the forums before creating a topic.
To improve your chances of your issue(s) being solved, please provide as much information as possible about the issue(s) you are having. Also —whenever possible— please use the template given to you when creating a topic.
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ply = GetPlayerPed(-1)
local plyCoords = GetEntityCoords(ply, 0)
for _, sted in pairs(kokain) do
local distance = GetDistanceBetweenCoords(sted.x, sted.y, sted.z, plyCoords["x"], plyCoords["y"], plyCoords["z"], true)
if(distance <= 1) then
DrawText3D(sted.x, sted.y, sted.z + 0.06, "~b~[Q]~s~ - Høst Kokain (~r~x10~w~)")
if(IsControlJustReleased(1, 44))then
--isfarmingkoka = true
exports['progressBars']:startUI(100000, "Høster Kokain (x10)")
TaskStartScenarioInPlace(PlayerPedId(), 'PROP_HUMAN_PARKING_METER', 0, true)
disableControls()
end
end
end
end
end)
function disableControls()
for i=1, 10000, 1 do
Citizen.Wait(0)
DisableControlAction(0,51,true)
DisableControlAction(0,20,true)
end
ClearPedTasksImmediately(GetPlayerPed(-1))
TriggerServerEvent('kokain2')
end
Ok so i used your code, but now it doesen’t seem to stop the animation or show the 3dtext up again. I don’t get any erros in the console or in the f8 console. After the progressbar stop, my ped just keeps doing the animation and the 3dtext doesent appear again. It executes the server function so i get the items but the other things doesent seem to work, any ideas?
Can you explain what is your goal? so we could think a better way to make this work, you want to be able only to choose only one option [Q] or [E] right?
But in your pastebin i only see one IsControlJustReleased so where is that other one? dont tell me you have two loops at one place.
I still dont understand why you want to disable controls in that loop if you dont want to get that button in this “collecting” getting clicked multiple times you can just easily make something like this:
local collecting = 0
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ply = GetPlayerPed(-1)
local plyCoords = GetEntityCoords(ply, 0)
for _, sted in pairs(kokain) do
local distance = GetDistanceBetweenCoords(sted.x, sted.y, sted.z, plyCoords["x"], plyCoords["y"], plyCoords["z"], true)
if(distance <= 1) then
DrawText3D(sted.x, sted.y, sted.z, "~b~[E]~s~ - Høst Kokain")
if(IsControlJustReleased(1, 51))then
if collecting == 0 then
collecting = 1
exports['progressBars']:startUI(10000, "Høster Kokain Kokain")
TaskStartScenarioInPlace(PlayerPedId(), 'PROP_HUMAN_PARKING_METER', 0, true)
--your function here to get that item like Citizen.Wait(10000) and that server event after
Citizen.Wait(10000)
ClearPedTasksImmediately(GetPlayerPed(-1))
TriggerServerEvent('kokain')
collecting = 0 -- setting this to 0 to allow to collect again
else
-- already collecting
end
end
end
end
end
end)
I just want so you can’t click both Q and E on the same time. Thats all im lookinbg for. Currently when you start faming the things start but in the same time you can press both Q and E so you can do like double farming.
local collect = false
Citizen.CreateThread(function()
while true do
if collect then
DisableControlAction(0,51,true)
DisableControlAction(0,20,true)
Wait(0)
else
Wait(250)
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ply = GetPlayerPed(-1)
local plyCoords = GetEntityCoords(ply, 0)
for _, sted in pairs(kokain) do
local distance = GetDistanceBetweenCoords(sted.x, sted.y, sted.z, plyCoords["x"], plyCoords["y"], plyCoords["z"], true)
if(distance <= 1) then
DrawText3D(sted.x, sted.y, sted.z + 0.06, "~b~[Q]~s~ - Høst Kokain (~r~x10~w~)")
if(IsControlJustReleased(1, 44))then
--isfarmingkoka = true
collect = true
exports['progressBars']:startUI(100000, "Høster Kokain (x10)")
TaskStartScenarioInPlace(PlayerPedId(), 'PROP_HUMAN_PARKING_METER', 0, true)
Citizen.Wait(100000)
ClearPedTasksImmediately(GetPlayerPed(-1))
TriggerServerEvent('kokain2')
collect = false
end
end
end
end
end)