I am new to scripting in lua, but I try to fix an existing script. It's a script that can be used in FiveM. It is used to impound vehicles. This is the code:
Line 1:
local currentTask = {}
Starting at line 852:
852 elseif action == 'impound' then
853
854 -- is the script busy?
855 if CurrentTask.Busy then
856 return
857 end
858
859 ESX.ShowHelpNotification(_U('impound_prompt'))
860
861 TaskStartScenarioInPlace(playerPed, 'CDE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true)
862
863 CurrentTask.Busy = true
864 CurrentTask.Task = ESX.SetTimeout(10000, function()
865 ClearPedTasks(playerPed)
866 ImpoundVehicle(vehicle)
867 Citizen.Wait(100) -- sleep the entire script to let stuff sink back to reality
868 end)
869
870 -- keep track of that vehicle!
871 Citizen.CreateThread(function()
872 while CurrentTask.Busy do
873 Citizen.Wait(1000)
874
875 vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 3.0, 0, 71)
876 if not DoesEntityExist(vehicle) and CurrentTask.Busy then
877 ESX.ShowNotification(_U('impound_canceled_moved'))
878 ESX.ClearTimeout(CurrentTask.Task)
879 ClearPedTasks(playerPed)
880 CurrentTask.Busy = false
881 break
882 end
883 end
884 end)
885 end
886 else
887 ESX.ShowNotification(_U('no_vehicles_nearby'))
888 end
889
890 end, function(data2, menu2)
891 menu2.close()
892 end)
I tried commenting lines 855, 856 and 857. But then I get the same error on line 864