Thread: special letters
View Single Post
01-04-13, 07:32 PM   #10
Anja
A Fallenroot Satyr
 
Anja's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 27
Lua Code:
  1. SLASH_DKP1 = "/dkp"
  2. SlashCmdList["DKP"] = function(msg, editBox)
  3.     -- change the text on the editBox.
  4.     print("Du hast "..gdkp.players.Ikuria.DKP.. "DKP")
  5. end
  6.  
  7. local function filter(self, event, msg, sender)
  8.     split = string.match(msg, " (%S+)")
  9.     if (split) then
  10.     firstchar = split:sub(1,1)
  11.     firstchar = firstchar:upper()
  12.     split = split:sub(2)
  13.     split = firstchar .. split
  14.     end
  15.     if (self:GetName() == "ChatFrame5") then
  16.         if (msg == "!dkp" or msg == "?dkp") then
  17.             if (gdkp.players[sender]) then
  18.                 SendChatMessage("Du hast "..gdkp.players[sender].DKP.. " DKP aus ".. gdkp.players[sender].rcount .. " Std. gespielter Raidzeit.", "WHISPER", nil, sender)
  19.                 return true
  20.             else
  21.                 SendChatMessage("Der Spieler "..sender.. " wurde nicht gefunden.", "WHISPER", nil, sender)
  22.                 return true
  23.             end
  24.         elseif (gdkp.players[split]) then
  25.             SendChatMessage(split.." hat "..gdkp.players[split].DKP.. " DKP aus ".. gdkp.players[split].rcount .. " Std. gespielter Raidzeit.", "WHISPER", nil, sender)
  26.             return true
  27.         end
  28.     else
  29.         if (msg == "!dkp" or msg == "?dkp") then
  30.             return true
  31.         end
  32.     end
  33. end
  34.  
  35.  
  36. local function HideOutgoing(self, event, msg, author, ...)
  37.     if (self:GetName() == "ChatFrame5") then
  38.         if (msg == string.match(msg, "Du hast %d+ DKP aus %d+ Std. gespielter Raidzeit")) then
  39.             UIErrorsFrame:AddMessage(author.." fragte seine DKP ab.", 1.0, 0.0, 0.0, 53, 5);
  40.             return true
  41.         elseif (msg == string.match(msg, ".+ hat %d+ DKP aus %d+ Std. gespielter Raidzeit.")) then
  42.             split = string.match(msg, "(%S+) hat .+")
  43.             UIErrorsFrame:AddMessage(author.." fragte "..split.."'s DKP ab.", 1.0, 0.0, 0.0, 53, 5);
  44.             return true
  45.         elseif (msg == string.match(msg, "Der Spieler (%S+) wurde nicht gefunden.")) then
  46.             return true
  47.         end
  48.     else
  49.         return true
  50.     end
  51. end
  52.  
  53. ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", HideOutgoing)
  54. 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 ^^
  Reply With Quote