Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. local ChatPrefix = "#w";
  2. local WorldChannelName = "World Channel";
  3. local CooldownTimer = 5; -- Cooldown in seconds. Set to 0 for no CD obviously.
  4.  
  5. local Class = { -- Class colors :) Prettier and easier than the elseif crap :) THESE ARE HEX COLORS!
  6.     [1] = "C79C6E", -- Warrior
  7.     [2] = "F58CBA", -- Paladin
  8.     [3] = "ABD473", -- Hunter
  9.     [4] = "FFF569", -- Rogue
  10.     [5] = "FFFFFF", -- Priest
  11.     [6] = "C41F3B", -- Death Knight
  12.     [7] = "0070DE", -- Shaman
  13.     [8] = "69CCF0", -- Mage
  14.     [9] = "9482C9", -- Warlock
  15.     [11] = "FF7d0A" -- Druid
  16. };
  17.  
  18. local Rank = {
  19.     [0] = "7DFF00", -- Player
  20.     [1] = "E700B1", -- Moderator
  21.     [2] = "E7A200", -- Game Master
  22.     [3] = "E7A200", -- Admin
  23.     [4] = "E7A200" -- Console
  24. };
  25.  
  26.  -- Do not edit below unless you know what you're doing :)
  27. if (ChatPrefix:sub(-1) ~= " ") then
  28.     ChatPrefix = ChatPrefix.." ";
  29. end
  30.  
  31. local RCD = {};
  32. function ChatSystem(event, player, msg, _, lang)
  33.     if (RCD[player:GetGUIDLow()] == nil) then
  34.         RCD[player:GetGUIDLow()] = 0;
  35.     end
  36.     if (msg:sub(1, ChatPrefix:len()) == ChatPrefix) then
  37.         local r = RCD[player:GetGUIDLow()] - os.clock();
  38.         if (0 < r) then
  39.             local s = string.format("|cFFFF0000You must wait %i second(s) before sending another chat message!|r", math.floor(r));
  40.             player:SendAreaTriggerMessage(s);
  41.         else
  42.             RCD[player:GetGUIDLow()] = os.clock() + CooldownTimer;
  43.             local t = table.concat({"|cff7DFF00[", WorldChannelName, "] [|r|cff", Rank[player:GetGMRank()] or Rank[0], "|Hplayer:", player:GetName(), "|h", player:GetName(), "|h|r|cff7DFF00]: |r|cff", Class[player:GetClass()], msg:sub(ChatPrefix:len()+1), "|r"});
  44.             SendWorldMessage(t);
  45.         end
  46.         return false;
  47.     end
  48. end
  49.  
  50. RegisterPlayerEvent(18, ChatSystem);
  51. RegisterPlayerEvent(4, function(_, player) RCD[player:GetGUIDLow()] = 0; end);