所以我为我的服务器获取了一些插件,并不断收到这两个错误。
这是我的两个代码。
1:表索引为零,
ESX.RegisterServerCallback('esx_weashop:requestDBItems', function(source, cb)
MySQL.Async.fetchAll(
'SELECT * FROM weashops',
{},
function(result)
local shopItems = {}
for i=1, #result, 1 do
if shopItems[result[i].name] == nil then
shopItems[result[i].name] = {}
end
table.insert(shopItems[result[i].name], {
name = result[i].item,
price = result[i].price,
label = ESX.GetWeaponLabel(result[i].item)
})
end
if Config.EnableClipGunShop == true then
table.insert(shopItems["GunShop"], {
name = "clip",
price = GunShopPrice,--Config.EnableClip.GunShop.Price,
label = GunShopLabel--Config.EnableClip.GunShop.label
})
end
if Config.EnableClipGunShop == true then
table.insert(shopItems["BlackWeashop"], {
name = "clip",
price = BlackWeashopPrice,--Config.EnableClip.BlackWeashop.Price,
label = BlackWeashopLabel--Config.EnableClip.BlackWeashop.label
})
end
cb(shopItems)
end
)
end)
2:尝试索引一个零值(本地,xPlayer)
AddEventHandler('esx:playerLoaded', function(playerId, xPlayer)
MySQL.Async.fetchAll('SELECT status FROM users WHERE identifier = @identifier', {
['@identifier'] = xPlayer.identifier
}, function(result)
local data = {}
if result[1].status then
data = json.decode(result[1].status)
end
xPlayer.set('status', data)
TriggerClientEvent('esx_status:load', playerId, data)
end)
end)