You need to use
CombatLogGetCurrentEventInfo() and you should post your full code if you want to get better help with your code
https://wow.gamepedia.com/COMBAT_LOG_EVENT
Lua Code:
local playerGUID = UnitGUID("player")
local f = CreateFrame("Frame")
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
f:SetScript("OnEvent", function(self, event)
self:OnEvent(event, CombatLogGetCurrentEventInfo())
end)
function f:OnEvent(event, ...)
local timestamp, subevent, _, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = ...
if subevent == "UNIT_DIED" and destGUID == playerGUID then
print("You died.")
end
end
As for just the player dying, that can be easier done with
PLAYER_DEAD
Lua Code:
local function OnEvent(self, event, ...)
print("You died.")
end
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_DEAD")
f:SetScript("OnEvent", OnEvent)