Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- rank_str is the prefix shown before the players name, rank_col and bracket_col are colors obviously (RGB).
- local function AddToChat(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()
- local rank_str, rank_col, bracket_col
- if ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("owner") then
- rank_str = "Owner"
- rank_col ord operator">= Color( 0, 0, 232 )
- bracket_col ord operator">= Color( 0, 0, 232)
- elseif ply:IsValid() ord">and ply:IsPlayer() and ply:IsUserGroup("coder") then
- rank_str = "Coder"
- rank_col = Color( 255, 51, 255 )
- bracket_col = Color( 255, 51, 255 )
- elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("superadmin") then
- rank_str = "Super-Admin"
- rank_col = Color( 232, 0, 0 )
- bracket_col = Color( 232, 0, 0 )
- ="keyword">elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("admin") then
- rank_str = "Admin"
- rank_col = Color( 25, 25, 112 )
- bracket_col = Color( 25, 25, 112 )
- ="keyword">elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("moderator") then
- rank_str = "Mod"
- rank_col = Color( 0, 101, 0 )
- bracket_col = Color( 0, 101, 0 )
- elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("Donor") then
- rank_str = "Donor"
- rank_col = Color( 219, 169, 18 )
- bracket_col = Color( 219, 169, 18 )
- elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("user") then
- rank_str = "Player"
- rank_col = Color( 255, 255, 255 )
- bracket_col = Color( 255, 255, 255 )
- else
- rank_str = ""
- rank_col = Color( 255, 255, 255 )
- end
- if text and text ~= "" then
- function">chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", col1, name, col2, ": "..text)
- if IsValid(ply) then
- hook.Call("OnPlayerChat", nil, ply, text, false, not ply:Alive())
- end
- else
- chat.AddText(col1, name)
- hook.Call("ChatText", nil, "0", name, name, "none")
- end
- chat.PlaySound()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement