首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用es_extended Fivem (Lua)解决问题

如何使用es_extended Fivem (Lua)解决问题
EN

Stack Overflow用户
提问于 2020-05-07 23:05:32
回答 1查看 12.2K关注 0票数 0

我对es_extended有个问题。

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

提前谢谢你。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-05-12 19:08:50

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

代码语言:javascript
复制
    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)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61661132

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档