Adding different icons for different groups wont work?

im trying to add different icons for groups but they wont work for my chat? im using silkchat and here is the full code. they show up as purple and black icons. also for owner and moderator i added custom icon16 in there but it wont work it only works for vip since i used one that was already in there

[lua]if SERVER then

AddCSLuaFile()
return;

end

local bnmk_start = CurTime()
MsgC(Color(0, 160, 255), "] SilkChat v1.5 by VorteX
")
MsgC(Color(0, 160, 255), "] Thanks to _Undefined for his Lua Dump!
")

– surface.CreateFont(“coolvetica”, 20, 400, true, false, “SilkChatFont”, false, false)

surface.CreateFont(“SilkChatFont”, {

font = "Coolvetica",
size = 20,
weight = 400,
antialias = true

})

local ChatBox = {}

ChatBox.ShowChat = false
ChatBox.Lines = {}
ChatBox.Chat = “”
ChatBox.TeamChat = false
ChatBox.TexIDs = {}
ChatBox.DefaultIcon = “icon16/information.png”

ChatBox.LinesToShow = 8

local function isDarkRP()

local b = false

if LocalPlayer().DarkRPVars != nil then
	
	b = true
	
end

return b

end

local function ToWidth(s)
surface.SetFont(“SilkChatFont”)
return surface.GetTextSize(s)
end

local function ColorAlpha(col, alpha)
return Color(col.r, col.g, col.b, alpha)
end

local function getPlayerIcon(ply)

local icon = "icon16/user.png"

if LevelIcon and ASS_VERSION then // hey assmod!
		
	icon = LevelIcon[ply:GetNWInt("ASS_isAdmin", 5)]
 else
      
    if ply:IsSuperAdmin() then
          
        icon = "icon16/shield_add.png"
          
    elseif ply:IsAdmin() then
          
        icon = "icon16/shield.png"
          
    elseif ply:IsUserGroup("Owner") then
         
        icon = "icon16/shield_rainbow.png"
   
    elseif ply:IsUserGroup("moderator") then
         
        icon = "icon16/shield_silver.png"
		
    elseif ply:IsUserGroup("vip") then
         
        icon = "icon16/award_star_gold_3.png"
    end

end

return icon

end

function ChatBox.AddLine(icon, …)
table.insert(ChatBox.Lines, 1, {
text = {…},
time = CurTime(),
– icon = surface.GetTextureID(icon)
icon = icon
})
ChatBox.Lines[ChatBox.LinesToShow + 1] = nil
end

local x, y = 35, ScrH() - 133
local chaticon, teamchaticon = “icon16/world.png”, “icon16/group.png”

hook.Add(“HUDPaint”, “DrawChat”, function()
for k, line in pairs(ChatBox.Lines) do
if ChatBox.ShowChat or line.time > CurTime() - 20 then
local alpha100 = 100
local alpha255 = 255

		if ChatBox.ShowChat then
			alpha100 = 150
			alpha255 = 255
		else
			alpha100 = math.Clamp(5 - ((CurTime() - (line.time + 20))) * 20, 0, 100)
			alpha255 = math.Clamp(5 - ((CurTime() - (line.time + 20))) * 20, 0, 255)
		end
		
		local width = 0
		
		for _, part in pairs(line.text) do
			if type(part) == "string" then
				width = width + ToWidth(part)
			elseif type(part) == "Player" and IsValid(part) then
				width = width + ToWidth(part:Nick())
			end
		end
		
		draw.RoundedBox(6, x, y + (-30 * k), width + 30, 23, Color(0, 0, 0, alpha100))
		
		if line.icon then
			-- surface.SetTexture(line.icon)
			surface.SetMaterial(Material(line.icon))
			surface.SetDrawColor(255, 255, 255, alpha255)
			surface.DrawTexturedRect(x + 6, y + (-30 * k) + 3, 16, 16)
		end
		
		local cur_x = x + 26
		local last_color = Color(255, 255, 255, 0)
		
		for _, part in pairs(line.text) do
			if type(part) == "string" then
				draw.SimpleText(part, "SilkChatFont", cur_x, y + (-30 * k) + 2, ColorAlpha(last_color, alpha255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT)
				cur_x = cur_x + ToWidth(part)
			elseif type(part) == "Player" then
				draw.SimpleText(part:Nick(), "SilkChatFont", cur_x, y + (-30 * k) + 2, ColorAlpha(team.GetColor(part:Team()), alpha255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT)
				cur_x = cur_x + ToWidth(part:Nick())
			elseif type(part) == "table" then
				last_color = part
			end
		end
	end
end

if ChatBox.ShowChat then
	draw.RoundedBox(6, x, y, ToWidth(ChatBox.Chat) + 30, 23, Color(0, 0, 0, 100))
	if ChatBox.TeamChat then
		icon = teamchaticon
	else
		icon = chaticon
	end
	surface.SetMaterial(Material(icon))
	surface.SetDrawColor(255, 255, 255, 255)
	surface.DrawTexturedRect(x + 6, y + 4, 16, 16)
	draw.SimpleText(ChatBox.Chat, "SilkChatFont", x + 26, y + 2, Color(255, 255, 255, 255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT)
end

end)

hook.Add(“OnPlayerChat”, “Text”, function(ply, text, teamchat, dead)
if isDarkRP() then return; end
if IsValid(ply) then
local icon

	-- if ply:IsAdmin() then
		-- icon = "shield"
	-- else
		-- icon = "user"
	-- end
	
	icon = getPlayerIcon(ply)
	
	if teamchat then icon = "icon16/group.png" end
	
	-- ChatBox.AddLine(icon, ply, ": ", text)
	ChatBox.AddLine(icon, team.GetColor(ply:Team()), ply:Nick(), Color(255, 255, 255, 255), ": ", text)
else
	ChatBox.AddLine("icon16/heart.png", "Jesus:", text)
end

return true

end)

local UserManagement = {
[“superadmin”] = {Icon = “icon16/shield_add.png”},
[“admin”] = {Icon = “icon16/shield.png”},
[“owner”] = {Icon = “icon16/shield_rainbow.png”},
[“moderator”] = {Icon = “icon16/shield_silver.png”},
[“vip”] = {Icon = “icon16/award_star_gold_3.png”},
}

function GetUserIcon(ply)
if !ply then return end
local group = ply:GetNWString( “UserGroup” )
local icon = UserManagement[group]
if icon then
return icon.Icon
end
return “”
end

–Example
print(GetUserIcon(Entity(1)))–me
print(GetUserIcon(Entity(2)))–bot returns “”

hook.Add(“ChatText”, “ChatMessages”, function(plindex, plname, text, typ)
if isDarkRP() then return; end
ChatBox.AddLine(“icon16/information.png”, text)
end)

if !oldchatAddText then

oldchatAddText = chat.AddText

end

function chat.AddText(…)

if isDarkRP() then oldchatAddText(Color(255, 255, 255), unpack({...})) return; end

local icon = false
local to_remove = false

for k, v in pairs({...}) do
	if type(v) == "table" and v.Icon and not v.r and not v.g and not v.b and not v.a then
		icon = v.Icon
		to_remove = k
	end
end

if not icon then
	icon = ChatBox.DefaultIcon
else
	table.remove({...}, to_remove)
end

ChatBox.AddLine(icon, unpack({...}))
oldchatAddText(Color(255, 255, 255), unpack({...}))

end

local function SilkChat_DarkRP(msg)

local col1 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())

local name = msg:ReadString()
local ply = msg:ReadEntity()
ply = IsValid(ply) and ply or LocalPlayer()

if name == "" or not name then
	name = ply:Nick()
	name = name ~= "" and name or ply:SteamName()
end

local col2 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())

local text = msg:ReadString()
if text and text ~= "" then
	
	-- chat.AddText(col1, name, col2, ": "..text)
	ChatBox.AddLine(getPlayerIcon(ply), col1, name, col2, ": "..text)
	
	-- if IsValid(ply) then
		-- hook.Call("OnPlayerChat", nil, ply, text, false, not ply:Alive())
	-- end
	
else

	-- chat.AddText(col1, name)
	ChatBox.AddLine("icon16/information.png", col1, name)
	-- hook.Call("ChatText", nil, "0", name, name, "none")
	
end
chat.PlaySound()

end
hook.Add( “Initialize”, “SilkChat_DarkRP_Initialize”, function()

usermessage.Hook("DarkRP_Chat", SilkChat_DarkRP)

end)

hook.Add(“StartChat”, “StartChat”, function()
ChatBox.ShowChat = true
return true
end)

hook.Add(“FinishChat”, “FinishChat”, function()
ChatBox.ShowChat = false
ChatBox.TeamChat = false
return false
end)

hook.Add(“ChatTextChanged”, “TextChanged”, function(text)
ChatBox.Chat = text
end)

hook.Add(“PlayerBindPress”, “PlayerBindPress”, function(ply, bind, pressed)
if string.find(bind, “messagemode2”) then
ChatBox.TeamChat = true
end
end)
local bnmk_end = CurTime()
local loadedin = bnmk_end - bnmk_start
MsgC(Color(0, 160, 255), "] Loaded in " … loadedin … "s
")[/lua]