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

[SOLVED] how to add icons to my chat?

Status
Not open for further replies.

Djundead

Foufos
Code:
-- Based on Account Rank: Gamemaster (1|2), Developer (3), Administrator (4), Owner (5)
local accountRank = { 
	[0] = "[|cffff0000Player|r] ",	
	[1] = "[|cffff0000Prohex Gamemaster|r] ",
    [2] = "[|cffff0000Prohex Gamemaster|r] ",
    [3] = "[|cffff0000Prohex Developer|r] ",
    [4] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:15:15:0:-1|t |cff00FF96Prohex Owner|r] ",
    [5] = "[|cff999999Prohex Administrator|r] "
};

-- Based on Faction: Alliance (0), Horde (1)
local chatColor = { [0] = "|cff0070DE",
	[1] = "|cffff0000"
};

function ChatSystem(event, player, msg, type, lang, channel)
	if (channel == 0) then
		if (player:GetGMRank() > 0) then
			local t = table.concat{accountRank[player:GetGMRank()], player:GetName(), "|h", "|r: ", chatColor[player:GetTeam()],  msg};
			SendWorldMessage(t)
			return false;
		elseif (player:GetRMRank() == 0) then
			if (VIP(player) == 0) then
				local t = table.concat{"[", chatColor[player:GetTeam()], "Player|r]", player:GetName(), "|h", "|r: ", chatColor[player:GetTeam()],  msg};
			elseif (VIP(player) > 0) then
				local t = table.concat{"<|cffff6600VIP|r>", player:GetName(), "|h|r: |cffff6600", msg};
			end	
			SendWorldMessage(t)
			return false;
		end
	end
end

local function VIP(player)
	local result = AuthDBQuery("SELECT vip FROM account WHERE username = " .. player:GetAccountName())
	local rank = result:GetUInt32(0)
	return rank;
end

RegisterPlayerEvent(22, ChatSystem)

is my code how do i add team icons as in class icons
 
Last edited:

Tommy

Founder
For one you need to make a table[classId, iconStr].

I'm not sure what the class icon paths are so maybe you can find them or someone can help. For now, I'm going to use a placeholder icon.

Code:
local classes =
{
    [1] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:15:15:0:-1|t]",  -- Warrior
    [2] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:15:15:0:-1|t]",  -- Paladin
    [3] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:15:15:0:-1|t]",  -- Hunter
    [4] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:15:15:0:-1|t]",  -- Rogue
    [5] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:15:15:0:-1|t]",  -- Priest
    [6] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:15:15:0:-1|t]",  -- Death Knight
    [7] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:15:15:0:-1|t]",  -- Shaman
    [8] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:15:15:0:-1|t]",  -- Mage
    [9] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:15:15:0:-1|t]",  -- Warlock
    [10] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:15:15:0:-1|t]", -- Unk
    [11] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:15:15:0:-1|t]"  -- Druid
}

Now you can copy the code below and put it on table.concat or where ever you see fit:

Code:
classes[player:GetClass()]
 

slp13at420

Mad Scientist
there was a site that showed a lot of icons and there location `http://sethcoder.com/reference/wow/INTERFACE/` but it looks like its down ...

you can also look at other scripts using icons like --> http://emudevs.com/showthread.php/2265-Eluna-World-chat-icons

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

function ChatSystem(event, player, msg, type, lang, channel)
	if(channel==0)then
		local t = table.concat{Team[player:GetTeam()], [COLOR="#FF0000"]Class[player:GetClass()][/COLOR], Gmrank[player:GetGMRank()], WorldChannelName, "[|cff3399ff","|Hplayer:", player:GetName(),  "|h", player:GetName(), "|h", "|r]:|cff00cc00",  msg};
		SendWorldMessage(t);
	return false;
	end
end

stripped down the code to just show how I implemented class icons.
i'm using the players class id `player:GetClass()` as the key `Class[player:GetClass()]`. there isn't a class 10 so it stays empty.
 
Last edited:

Tommy

Founder
there was a site that showed a lot of icons and there location `http://sethcoder.com/reference/wow/INTERFACE/` but it looks like its down ...

you can also look at other scripts using icons like --> http://emudevs.com/showthread.php/2265-Eluna-World-chat-icons

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

function ChatSystem(event, player, msg, type, lang, channel)
	if(channel==0)then
		local t = table.concat{Team[player:GetTeam()], [COLOR="#FF0000"]Class[player:GetClass()][/COLOR], Gmrank[player:GetGMRank()], WorldChannelName, "[|cff3399ff","|Hplayer:", player:GetName(),  "|h", player:GetName(), "|h", "|r]:|cff00cc00",  msg};
		SendWorldMessage(t);
	return false;
	end
end

stripped down the code to just show how I implemented class icons.
i'm using the players class id `player:GetClass()` as the key `Class[player:GetClass()]`. there isn't a class 10 so it stays empty.

wowprogramming is a better site to use. I use it all the time when messing with stuff like this: http://wowprogramming.com/utils/artbrowser/Interface
 
Status
Not open for further replies.
Top