• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

World Chat

Status
Not open for further replies.

Barebones

BETA Tester
Is there anything wrong with this script? It works for my core but not someone else's and it should.

Code:
local ChatPrefix = "#w";
local WorldChannelName = "World Channel";
local CooldownTimer = 5; -- Cooldown in seconds. Set to 0 for no CD obviously.
 
local Team =  {
				[0] = " |TInterface\\WorldStateFrame\\AllianceIcon.png:20|t",
				[1] = " |TInterface\\WorldStateFrame\\HordeIcon.png:20|t"
				};
 
local Class = { -- Class colors :) Prettier and easier than the elseif crap :) THESE ARE HEX COLORS!
  			    [1] = "|TInterface\\icons\\INV_Sword_27.png:15|t]",
		        [2] = "|TInterface\\icons\\INV_Hammer_01.png:15|t]",
		        [3] = "|TInterface\\icons\\INV_Weapon_Bow_07.png:15|t]",
		        [4] = "|TInterface\\icons\\INV_ThrowingKnife_04.png:15|t]",
		        [5] = "|TInterface\\icons\\INV_Staff_30.png:15|t]",
		        [6] = "|TInterface\\icons\\Spell_Deathknight_ClassIcon.png:15|t]",
		        [7] = "|TInterface\\icons\\inv_jewelry_talisman_04.png:15|t]",
		        [8] = "|TInterface\\icons\\INV_Staff_30.png:15|t]",
		        [9] = "|TInterface\\icons\\INV_Staff_30.png:15|t]",
		        [11] = "|TInterface\\icons\\Ability_Druid_Maul.png:15|t]",
				};
				
local ClassColor = { -- Class colors :) Prettier and easier than the elseif crap :) THESE ARE HEX COLORS!
        [1] = "C79C6E", -- Warrior
        [2] = "F58CBA", -- Paladin
        [3] = "ABD473", -- Hunter
        [4] = "FFF569", -- Rogue
        [5] = "FFFFFF", -- Priest
        [6] = "C41F3B", -- Death Knight
        [7] = "0070DE", -- Shaman
        [8] = "69CCF0", -- Mage
        [9] = "9482C9", -- Warlock
        [11] = "FF7d0A" -- Druid
		};
 
local Rank = {
				[0] = "",
				[1] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t",
				[2] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t",
				[3] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t",
				[4] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t",
				[5] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t"
				};

 
 -- Do not edit below unless you know what you're doing :)
if (ChatPrefix:sub(-1) ~= " ") then
        ChatPrefix = ChatPrefix.." ";
end
 
local RCD = {};
function ChatSystem(event, player, msg, _, lang)
        if (RCD[player:GetGUIDLow()] == nil) then
                RCD[player:GetGUIDLow()] = 0;
        end
        if (msg:sub(1, ChatPrefix:len()) == ChatPrefix) then
                local r = RCD[player:GetGUIDLow()] - os.clock();
                if (0 < r) then
                        local s = string.format("|cFFFF0000You must wait %i second(s) before sending another chat message!|r", math.floor(r));
                        player:SendAreaTriggerMessage(s);
                else
                        RCD[player:GetGUIDLow()] = os.clock() + CooldownTimer;
                        local t = table.concat({"[", WorldChannelName, "] ", Rank[player:GetGMRank()] or Rank[0], Team[player:GetTeam()], Class[player:GetClass()], " [|Hplayer:",  "|h", player:GetName(),"|h]: |r|cff", ClassColor[player:GetClass()], msg:sub(ChatPrefix:len()+1), "|r"});
                        SendWorldMessage(t);
                end
                return false;
        end
end
 
RegisterPlayerEvent(18, ChatSystem);
RegisterPlayerEvent(4, function(_, player) RCD[player:GetGUIDLow()] = 0; end);
 
Last edited:

Rochet2

Moderator / Eluna Dev
Looks fine to me.
The Whoeveritis should probably update : |

Now that I tested it it seems that the image links are wrong .. hmm?
6vj7m.jpg
 

Barebones

BETA Tester
That's what I told him. haha

But that's odd

- - - Updated - - -

local Team = {
[0] = " |TInterface\\WorldStateFrame\\AllianceIcon.png:20|t ",
[1] = " |TInterface\\WorldStateFrame\\HordeIcon.pngpng:20|t "
};

I removed the spaces to the right of the 't', but i don't think it would really matter. Script is working fine for me.
 

Rochet2

Moderator / Eluna Dev
Its the spaces.
After deleting them it works.
Also, note this:
HordeIcon.pngpng

You should probably check those again :)
6vk5H.jpg

Also see the extra [ before blizz icon^
 

Barebones

BETA Tester
Well, it's not extra. It's supposed to be there. It just so happened that I accidentally took away the ] after the priest symbol.

Updated, obv available it anyone else wants it.
 

Rochet2

Moderator / Eluna Dev
Try this:
Code:
local ChatPrefix = "#w";
local WorldChannelName = "World Channel";
local CooldownTimer = 5; -- Cooldown in seconds. Set to 0 for no CD obviously.

local Team = {
[0] = " |TInterface\\WorldStateFrame\\AllianceIcon.png:20|t ",
[1] = " |TInterface\\WorldStateFrame\\HordeIcon.png:20|t "
};

local Class = {
[1] = "|TInterface\\icons\\INV_Sword_27.png:15|t",
[2] = "|TInterface\\icons\\INV_Hammer_01.png:15|t",
[3] = "|TInterface\\icons\\INV_Weapon_Bow_07.png:15|t",
[4] = "|TInterface\\icons\\INV_ThrowingKnife_04.png:15|t",
[5] = "|TInterface\\icons\\INV_Staff_30.png:15|t",
[6] = "|TInterface\\icons\\Spell_Deathknight_ClassIcon.png:15|t",
[7] = "|TInterface\\icons\\inv_jewelry_talisman_04.png:15|t",
[8] = "|TInterface\\icons\\INV_Staff_30.png:15|t",
[9] = "|TInterface\\icons\\INV_Staff_30.png:15|t",
[11] = "|TInterface\\icons\\Ability_Druid_Maul.png:15|t",
};

local ClassColor = { -- Class colors :) Prettier and easier than the elseif crap :) THESE ARE HEX COLORS!
[1] = "C79C6E", -- Warrior
[2] = "F58CBA", -- Paladin
[3] = "ABD473", -- Hunter
[4] = "FFF569", -- Rogue
[5] = "FFFFFF", -- Priest
[6] = "C41F3B", -- Death Knight
[7] = "0070DE", -- Shaman
[8] = "69CCF0", -- Mage
[9] = "9482C9", -- Warlock
[11] = "FF7d0A" -- Druid
};

local Rank = {
[0] = "",
[1] = "|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:20:0:-1|t",
[2] = "|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:20:0:-1|t",
[3] = "|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:20:0:-1|t",
[4] = "|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:20:0:-1|t",
[5] = "|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:20:0:-1|t"
};

-- Do not edit below unless you know what you're doing :)
if (ChatPrefix:sub(-1) ~= " ") then
ChatPrefix = ChatPrefix.." ";
end

local RCD = {};
function ChatSystem(event, player, msg, _, lang)
    if (RCD[player:GetGUIDLow()] == nil) then
        RCD[player:GetGUIDLow()] = 0;
    end
    if (msg:sub(1, ChatPrefix:len()) == ChatPrefix) then
        local r = RCD[player:GetGUIDLow()] - os.clock();
        if (0 < r) then
            local s = string.format("|cFFFF0000You must wait %i second(s) before sending another chat message!|r", math.floor(r));
            player:SendAreaTriggerMessage(s);
        else
            RCD[player:GetGUIDLow()] = os.clock() + CooldownTimer;
            local t = table.concat({"[", WorldChannelName, "] ", Rank[player:GetGMRank()] or Rank[0], Team[player:GetTeam()], Class[player:GetClass()], " |Hplayer:", player:GetName(),"|h[", player:GetName(),"]|h: |cff", ClassColor[player:GetClass()], msg:sub(ChatPrefix:len()+1)});
            SendWorldMessage(t);
        end
        return false;
    end
end

RegisterPlayerEvent(18, ChatSystem);
RegisterPlayerEvent(4, function(_, player) RCD[player:GetGUIDLow()] = 0; end);

I fixed the name link, images and so on.

btw, warlock and mage icons are priest icons atm ?_?
 
Last edited:

slp13at420

Mad Scientist
lol when you start mod'n be prepared for tons of err's and tons `o` learnin . :D

- - - Updated - - -

lol tere are a lot of other icons hidden in and around that location . I linked a page that will help find other unique png's to use :D
 
Status
Not open for further replies.
Top