Chat Tag doesn't work

Okay this is the code:
[lua]local function AddToChat(msg)
local col1 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
local name = msg:ReadString()
local ply = msg:ReadEntity()
local col2 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
local text = msg:ReadString()
if text and text ~= “” then
if ply and ply:IsValid() and ply:IsPlayer() and ply:IsAdmin() then chat.AddText(col1, name, Color(0, 155, 0, 255), " (ADMIN) ", col2, ": "…text) else chat.AddText(col1, name, col2, ": "…text) end
if ply and ply:IsValid() then
hook.Call(“OnPlayerChat”, GM, ply, text, false, ply:Alive())
end
else
chat.AddText(col1, name)
hook.Call(“ChatText”, GM, “0”, name, “”, “none”)
end
chat.PlaySound()
end

usermessage.Hook(“DarkRP_Chat”, AddToChat)[/lua]

The problem is that it replace the player’s name with (ADMIN) instead of adding the tag next to the name. What exactly is the problem since I am too dumb enough to not see?

[lua]local function AddToChat(msg)
local col1 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
local name = msg:ReadString()
local ply = msg:ReadEntity()
local col2 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
local text = msg:ReadString()
if text and text ~= “” then
if ply and ply:IsValid() and ply:IsPlayer() and ply:IsAdmin() then chat.AddText(col1, name, Color(0, 155, 0, 255), " (ADMIN) " … ply:Nick() …, col2, ": "…text) else chat.AddText(col1, name, col2, ": "…text) end
if ply and ply:IsValid() then
hook.Call(“OnPlayerChat”, GM, ply, text, false, ply:Alive())
end
else
chat.AddText(col1, name)
hook.Call(“ChatText”, GM, “0”, name, “”, “none”)
end
chat.PlaySound()
end

usermessage.Hook(“DarkRP_Chat”, AddToChat)[/lua]

Try this I guess, might not work though.

Doesn’t work and I also want the admin tag to be after the player name.

Bump.

Anyone?

If you want I can help you threw steam.
Steam: http://steamcommunity.com/id/forsakenspade14

Why don’t you just help them here instead?

Try changing this to:


        if text and text ~= "" then
                if ply and ply:IsValid() and ply:IsPlayer() and ply:IsAdmin() then chat.AddText(col1, name, ply:GetName(), Color(0, 155, 0, 255), " (ADMIN) ", col2, ": "..text) else chat.AddText(col1, name, col2, ": "..text) end