Как решить проблему с es_extended Fivem (Lua) - PullRequest
0 голосов
/ 07 мая 2020

У меня проблема с es_extended.

У меня такая ошибка: SCRIPT ERROR: @es_extended/client/main.lua:64: attempt to index a nil value (field 'coords')

Заранее спасибо.

1 Ответ

0 голосов
/ 12 мая 2020

Это можно исправить, проверив, имеют ли координаты значение перед попыткой телепортации игрока.

    if playerData.coords == nil and playerData.coords.x == nil then playerData.coords = {x = -1070.906250, y = -2972.122803, z = 13.773568} end

    ESX.Game.Teleport(PlayerPedId(), {
       x = playerData.coords.x,
       y = playerData.coords.y,
       z = playerData.coords.z + 0.25
    }, function()
       TriggerServerEvent('esx:onPlayerSpawn')
       TriggerEvent('esx:onPlayerSpawn')
       TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon
       TriggerEvent('esx:restoreLoadout')

       Citizen.Wait(3000)
       ShutdownLoadingScreen()
       FreezeEntityPosition(PlayerPedId(), false)
       DoScreenFadeIn(10000)
       StartServerSyncLoops()
   end)
...