According to all the posts I’ve found on the forums, and the FiveM documentation, the arguments passed to ‘baseevents:onPlayerDied’ is (Player victim, String reason). However, I am getting (Player victim, Table vector3).
AddEventHandler('baseevents:onPlayerDied', function(victim, reason)
local ply = GetPlayerFromServerId(victim)
local x,y,z = table.unpack(reason)
print("Person died.")
print("ply: "..tostring(ply))
print("victim: "..tostring(victim))
print("reason: "..json.encode(reason))
print("pos: "..tostring(pos))
preDeath = true
end)
Result (F8):
Person died.
ply: -1
victim: 2
reason: [414.0212097168, -661.76226806641, 27.861423492432]
pos: vector3(0,0,0)
Can anyone tell me what I’m doing wrong so I can fix this annoying issue I’ve been troubleshooting for over an hour now? How do I get the reason of death in addition to the coordinates? GetEntityCoords(victim) or similar returns vector3(0,0,0). So I want to keep the coordinates if possible, but why am I not getting String reason?