esx-community / esx_thief

FXServer ESX Thief
GNU General Public License v3.0
32 stars 22 forks source link

First Start Problem #5

Closed dunof closed 6 years ago

dunof commented 6 years ago

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

DioneB commented 6 years ago

same error here

ZiNkxJ0sTeR commented 6 years ago

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

ZiNkxJ0sTeR commented 6 years ago

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.

cappish commented 6 years ago

Have the same issue, any luck on this error?

psycodeliccircus commented 6 years ago
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)
Lannebro commented 6 years ago

same problem.