尝试在FiveM esx_policejob上索引空值

尝试在本地变量'weapon'上索引空值

第一行是错误信息

local component = weapon.components[i]
local hasComponent = HasPedGotWeaponComponent(playerPed, GetHashKey(v.weapon), component.hash)

if hasComponent then
    label = ('%s: <span style="color:green;">%s</span>'):format(component.label, _U('armory_owned'))
else
    if v.components[i] > 0 then
        label = ('%s: <span style="color:green;">%s</span>'):format(component.label, _U('armory_item', ESX.Math.GroupDigits(v.components[i])))
    else
        label = ('%s: <span style="color:green;">%s</span>'):format(component.label, _U('armory_free'))
    end
end

1

原文链接 https://stackoverflow.com/questions/70578517

点赞
stackoverflow用户19163891
stackoverflow用户19163891

我不确定这是否可行,但这是我的解决方案:

检查你的脚本是否有这个设置!

ESX=nil

如果没有,请在顶部写入!

2022-08-10 16:51:54