So i figured it out, here is the snippet using 3 events.
Lua Code:
-- A player has requested to duel me
function Duelist:DUEL_REQUESTED(event, playerName)
opponentName = playerName
duelingOn = true
end
--I requested a duel to my target
function Duelist:CHAT_MSG_SYSTEM(event, text)
if string.find(text, _G.ERR_DUEL_REQUESTED ) then
if (UnitExists("target")) then
duelingOn = true
opponentName = UnitName("target")
end
end
end
-- The duel finished or was canceled
function Duelist:DUEL_FINISHED(event)
opponentName = ""
duelingOn = false
end