esx-community/esx_thief

First Start Problem

Closed this issue · 6 comments

dunof commented

Hello mates!
I copied the files and gave the start at server.cfg however I am with this error appearing on my console:

Error resuming coroutine: handsup.lua:25: attempt to call a nil value (global 'GetPlayerPed') stack traceback: handsup.lua:25: in function <handsup.lua:21>

the line 25 of handsup.lua:

local lPed = GetPlayerPed(-1)

How can I solve this problem? Every help is welcome!
Thank you

same error here

Tried multiple edits to both lines 21 and 25 but no luck here

I was told that the code is fine but something else must be conflicting with it to have this error and thus having the script not work properly.

Have the same issue, any luck on this error?

local canHandsUp = true
local GUI							= {}
GUI.Time							= 0

AddEventHandler("handsup:toggle", function(param)
	canHandsUp = param
end)

Citizen.CreateThread(function()
	local handsup = false
	while true do
		Wait(0)
		local lPed = GetPlayerPed(-1)
		RequestAnimDict("random@mugging3")
		if canHandsUp then
			if (IsControlPressed(1, Config.handsUP.clavier) and (GetGameTimer() - GUI.Time) > 150) or ((IsControlPressed(2, Config.handsUP.manette1) and IsControlPressed(2, Config.handsUP.manette2)) and (GetGameTimer() - GUI.Time) > 150) then
				if handsup then
					if DoesEntityExist(lPed) then
						Citizen.CreateThread(function()
							RequestAnimDict("random@mugging3")
							while not HasAnimDictLoaded("random@mugging3") do
								Citizen.Wait(100)
							end

							if handsup then
								handsup = false
								ClearPedSecondaryTask(lPed)
                                TriggerServerEvent("esx_thief:update", handsup)
							end
						end)
					end
				else
					if DoesEntityExist(lPed) then
						Citizen.CreateThread(function()
							RequestAnimDict("random@mugging3")
							while not HasAnimDictLoaded("random@mugging3") do
								Citizen.Wait(100)
							end

							if not handsup then
								handsup = true
								TaskPlayAnim(lPed, "random@mugging3", "handsup_standing_base", 8.0, -8, -1, 49, 0, 0, 0, 0)
                                TriggerServerEvent("esx_thief:update", handsup)
							end
						end)
					end
				end
				
				GUI.Time  = GetGameTimer()
			end

		end
	end
end)

same problem.