[ script:mrp-gangs] SCRIPT ERROR: @mrp-gangs/server.lua:822: attempt to index a nil value (local 'xKiller')
[ script:mrp-gangs] > handler (@ReaperAC/server.lua:5)
RegisterServerEvent('asd:onPlayerDeath')
AddEventHandler('asd:onPlayerDeath', function(data)
if data.killedByPlayer then
local xKiller = ASD.GetPlayerFromId(data.killerServerId)
TriggerClientEvent('asd_gangs:playerKilled', data.killerServerId)
end
end)
RegisterServerEvent('asd_gangs:sumPlayerKill')
AddEventHandler('asd_gangs:sumPlayerKill', function(id)
local xKiller = ASD.GetPlayerFromId(id)
MySQL.Sync.execute("UPDATE users SET kills = kills + 1 WHERE identifier = @identifier", {['@identifier'] = xKiller.getIdentifier()})
end)
ASD.GetPlayerFromId()is returning nil. Are you suredata.killerServerIdis valid, or even exists?One possible solution would be to check that the player with the
provided IDactually exists beforehand and, if not, then handle it differently.