0

我对 es_extended 有疑问。

我有这个错误: SCRIPT ERROR: @es_extended/client/main.lua:64: attempt to index a nil value (field 'coords')

先感谢您。

4

1 回答 1

0

这可以通过在尝试传送玩家之前检查坐标是否具有值来解决。

    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)
于 2020-05-12T11:08:49.600 回答