local ranks = {
["dev"] = Color(0,0,255),
["superadmin"] = Color(255,0,0),
["respected"] = Color(0,255,0),
["vip"] = Color(255,250,0),
["admin"] = Color(255,194,127),
["guest"] = Color(255,255,255),
["moderator"] = Color(255,0,255)
}
if (SERVER) then
AddCSLuaFile("chat.lua")
function CustomChat_ChatMessage(ply, msg, rank, r, g, b)
umsg.Start("CustomChat_ChatMsg")
umsg.Entity(ply)
umsg.String(msg)
umsg.String(rank)
umsg.Short(r)
umsg.Short(g)
umsg.Short(b)
umsg.End()
end
function CustomChat_Checker(ply, text, teamonly)
local group = ply:EV_GetRank()
local color = ranks[group]
local txtcheck = string.sub(text,1,1)
if txtcheck == "/" then
return text
else
return "", CustomChat_ChatMessage(ply, text, "["..string.upper(string.sub(group,1,1))..string.sub(group,2).."]", color.r, color.g, color.b)
end
end
hook.Add("PlayerSay", "WordCheck", CustomChat_Checker)
else
usermessage.Hook("CustomChat_ChatMsg", function(um)
local ply = um:ReadEntity()
local msg = um:ReadString()
local rank = um:ReadString()
local r = um:ReadShort()
local g = um:ReadShort()
local b = um:ReadShort()
chat.AddText(Color(r, g, b), rank, team.GetColor(ply:Team()), " "..ply:Nick(), Color(255,255,255), ": "..msg)
end)
end
Where does this go? I'm running TTT
Go to your shared.int in the gamemodes folder
Sorry, you need to Log In to post a reply to this thread.