Help with chat rank prefixs so they can use vtf files

how would I let myself add vtf file instead of the ranks name and then a coloured named?

what i mean by this is how do you add a picture as a tag.

i have seen it done befor but i have no idear how to add them. here is my prefixs code:


CreateClientConVar("chat_tags_color_r", 255, true, false)
CreateClientConVar("chat_tags_color_g", 255, true, false)
CreateClientConVar("chat_tags_color_b", 255, true, false)
CreateClientConVar("chat_tags_color_a", 255, true, false)

local Tags = 
{
--Group    --Tag     --Color
{"admin", "[Admin] ", Color(255, 0, 0, 255) },
{"superadmin", "[Superadmin] ", Color(200, 0, 0, 255) },
{"owner", "[Owner] ", Color(0, 0, 0, 255) },
{"vip", "[Vip] ", Color(255, 186, 0, 255) },
{"goat", "[] ", Color(100, 20, 130, 255) },
{"mod", "[Mod] ", Color(33, 75, 27, 255) },
}

hook.Add("OnPlayerChat", "Tags", function(ply, strText, bTeamOnly)
	if IsValid(ply) and ply:IsPlayer() then
		for k,v in pairs(Tags) do
			if ply:IsUserGroup(v[1]) then
			local R = GetConVarNumber("chat_tags_color_r")
			local G = GetConVarNumber("chat_tags_color_g")
			local B = GetConVarNumber("chat_tags_color_b")
			local A = GetConVarNumber("chat_tags_color_a")
			local nickteam = team.GetColor(ply:Team())
				if !bTeamOnly then
				chat.AddText(v[3], v[2], nickteam, ply:Nick(), color_white, ": ", Color(R, G, B, A), strText)
				return true
				else
				chat.AddText(v[3], v[2], nickteam, "(TEAM) ", ply:Nick(), color_white, ": ", Color(R, G, B, A), strText)
				return true
				end
			end
		end
	end
	if !IsValid(ply) and !ply:IsPlayer() then
	local ConsoleColor = Color(0, 255, 0) --Change this to change Console name color
	chat.AddText(ConsoleColor, "Console", color_white, ": ", strText)
	return true
	end
end )

and here is were i have stored all the pics for tags aka the directory’s:

dir:
resource.AddFile( “materials/sassilization/tags2/admintag.vmt” )
resource.AddFile( “materials/sassilization/tags2/admintag.vtf” )
resource.AddFile( “materials/sassilization/tags2/bhoptag3.vmt” )
resource.AddFile( “materials/sassilization/tags2/bhoptag3.vtf” )
resource.AddFile( “materials/sassilization/tags2/devtag.vmt” )
resource.AddFile( “materials/sassilization/tags2/devtag.vtf” )
resource.AddFile( “materials/sassilization/tags2/epictag.vmt” )
resource.AddFile( “materials/sassilization/tags2/epictag.vtf” )
resource.AddFile( “materials/sassilization/tags2/ftwtag.vmt” )
resource.AddFile( “materials/sassilization/tags2/ftwtag.vtf” )
resource.AddFile( “materials/sassilization/tags2/goattag.vmt” )
resource.AddFile( “materials/sassilization/tags2/goattag.vtf” )
resource.AddFile( “materials/sassilization/tags2/modtag2.vmt” )
resource.AddFile( “materials/sassilization/tags2/modtag2.vtf” )
resource.AddFile( “materials/sassilization/tags2/ownertag.vmt” )
resource.AddFile( “materials/sassilization/tags2/ownertag.vtf” )
resource.AddFile( “materials/sassilization/tags2/radiotag.vmt” )
resource.AddFile( “materials/sassilization/tags2/radiotag.vtf” )
resource.AddFile( “materials/sassilization/tags2/spacetag.vmt” )
resource.AddFile( “materials/sassilization/tags2/spacetag.vtf” )
resource.AddFile( “materials/sassilization/tags2/supertag.vmt” )
resource.AddFile( “materials/sassilization/tags2/supertag.vtf” )
resource.AddFile( “materials/sassilization/tags2/viptag.vmt” )
resource.AddFile( “materials/sassilization/tags2/viptag.vtf” )
resource.AddFile( “materials/sassilization/tags/girltag.vtf” )
resource.AddFile( “materials/sassilization/tags/gtag.vmt” )
resource.AddFile( “materials/sassilization/tags/gtag.vtf” )
end

hope you can help me if you do i will be eternally grateful. just to help heres a picture of how i would like it to look :slight_smile:

Imgur

if i din’t explain it well please ask what i was meant to say as I’m not great at English thx :stuck_out_tongue:

You can’t get this to work without custom chatbox.

were would i get a custom chatbox from that would allow me to do this?

You make one yourself. I heard of HatsChat, but I am not sure if it’s public or not.

ok i’l have a look into it but once i have got i how would i setup the prefixs?

[editline]17th December 2013[/editline]

i found these two part of the code in hats chat


	if ply then
		if ply:IsSuperAdmin() then
			AddMsg( {"LineIcon", "SuperAdmin"}, {"LineGlow", Color(255,255,255)}, unpack( tab ) )
		elseif ply:IsAdmin() then
			AddMsg( {"LineIcon", "Admin"}, {"LineGlow", Color(0,0,0)}, unpack( tab ) )
		elseif TEAM_SPECTATOR and ply:Team() == TEAM_SPECTATOR then
			AddMsg( {"LineIcon", "Spectator"}, unpack( tab ) )
		else
			AddMsg( {"LineIcon", "Player"}, unpack( tab ) )
		end
	else
		AddMsg( {"LineIcon", "Global"}, unpack( tab ) )
	end
end)

--chat.AddText messages
local OAddText = chat.AddText
function chat.AddText( ... )
	local args = { ... }
	
	local LineIcon, LineGlow
	
	--Easy way to add custom Line Icons
	if args[1] then
		if type(args[1]) == "table" and type(args[1][1])=="string" and string.lower(args[1][1]) == "lineicon" then
			--Custom line icon
			LineIcon = tostring(args[1][2])
			
			table.remove( args, 1 )
		elseif type(args[1]) == "Player" and IsValid(args[1]) then
			--Player-related icon
			--I know ttt would use this pre-beta, so this will keep the icons working adequately
			if args[1]:IsSuperAdmin() then
				LineIcon = "SuperAdmin"
				LineGlow = Color(255,255,255)
			elseif args[1]:IsAdmin() then
				LineIcon = "Admin"
				LineGlow = Color(0,0,0)
			else
				LineIcon = "Player"
			end
		end
	end
	

what would i edit to add the vtf icons