The first parameter in the payload for UNIT_xxx events is the unit that is the target of the event
Code:
local unit , x, x = ...
if unit == "player" then
-- you started casting, sent the cast, failed at casting, stopped casting or got the job done.
end
In your code, "UNIT_SPELLCAST_SENT is the only event where you check for the unit
Code:
local function OnEvent(self, event, ...)
local unit, arg2, arg3, arg4 = ...
if unit ~= "player" then
return
end
if event == "zzz" then
if arg2 == yyy then
-- whatever for event zzz
end
elseif event == "ddd" then
if arg3 == nnn then
-- whatever for event ddd
end
end
end