Lua Code:
SLASH_DKP1 = "/dkp"
SlashCmdList["DKP"] = function(msg, editBox)
-- change the text on the editBox.
print("Du hast "..gdkp.players.Ikuria.DKP.. "DKP")
end
local function filter(self, event, msg, sender)
split = string.match(msg, " (%S+)")
if (split) then
firstchar = split:sub(1,1)
firstchar = firstchar:upper()
split = split:sub(2)
split = firstchar .. split
end
if (self:GetName() == "ChatFrame5") then
if (msg == "!dkp" or msg == "?dkp") then
if (gdkp.players[sender]) then
SendChatMessage("Du hast "..gdkp.players[sender].DKP.. " DKP aus ".. gdkp.players[sender].rcount .. " Std. gespielter Raidzeit.", "WHISPER", nil, sender)
return true
else
SendChatMessage("Der Spieler "..sender.. " wurde nicht gefunden.", "WHISPER", nil, sender)
return true
end
elseif (gdkp.players[split]) then
SendChatMessage(split.." hat "..gdkp.players[split].DKP.. " DKP aus ".. gdkp.players[split].rcount .. " Std. gespielter Raidzeit.", "WHISPER", nil, sender)
return true
end
else
if (msg == "!dkp" or msg == "?dkp") then
return true
end
end
end
local function HideOutgoing(self, event, msg, author, ...)
if (self:GetName() == "ChatFrame5") then
if (msg == string.match(msg, "Du hast %d+ DKP aus %d+ Std. gespielter Raidzeit")) then
UIErrorsFrame:AddMessage(author.." fragte seine DKP ab.", 1.0, 0.0, 0.0, 53, 5);
return true
elseif (msg == string.match(msg, ".+ hat %d+ DKP aus %d+ Std. gespielter Raidzeit.")) then
split = string.match(msg, "(%S+) hat .+")
UIErrorsFrame:AddMessage(author.." fragte "..split.."'s DKP ab.", 1.0, 0.0, 0.0, 53, 5);
return true
elseif (msg == string.match(msg, "Der Spieler (%S+) wurde nicht gefunden.")) then
return true
end
else
return true
end
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", HideOutgoing)
ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", filter)
works, but the code is little messie ^^ just because of the "ChatFrame5" thing, i didnt know how to prevent the double posts because of same whispers in more tabs
sry for my problems here, i'm just learning lua at the moment ^^