Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local userGroups =
- {
- vip = true,
- moderator = true,
- superadmin = true,
- admin = true,
- user = true,
- headadmin = true,
- owner = true,
- respected = true,
- coder = true
- }
- hook.Add("OnPlayerChat", "prefixes", function(ply, text, teamOnly, alive, prefixText, color1, color2)
- if not userGroups[string.lower(ply:GetNWString("usergroup"))] then
- chat.AddText(Color(255, 0, 0, 255), "[" .. ply:GetNWString("usergroup") .. "] ", color1, prefixText, color2, ": "..text)
- return true
- elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("moderator") then
- rank_str = "Mod"
- rank_col = Color( 0, 255, 255 )
- bracket_col = Color( 0, 255, 255 )
- chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", color1, prefixText, color2, ": "..text)
- return true
- elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("superadmin") then
- rank_str = "SuperAdmin"
- rank_col = Color( 255, 51, 0 )
- bracket_col = Color( 255, 51, 0 )
- chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", color1, prefixText, color2, ": "..text)
- return true
- elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("owner") then
- rank_str = "Owner"
- rank_col = Color( 153, 0, 153 )
- bracket_col = Color( 153, 0, 153 )
- chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", color1, prefixText, color2, ": "..text)
- return true
- elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("admin") then
- rank_str = "Admin"
- rank_col = Color( 51, 255, 0 )
- bracket_col = Color( 51, 255, 0 )
- chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", color1, prefixText, color2, ": "..text)
- return true
- elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("vip") then
- rank_str = "VIP"
- rank_col = Color( 100, 255, 204 )
- bracket_col = Color( 100, 255, 204 )
- chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", color1, prefixText, color2, ": "..text)
- return true
- elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("respected") then
- rank_str = "Respected"
- rank_col = Color( 100, 0, 255 )
- bracket_col = Color( 100, 0, 255 )
- chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", color1, prefixText, color2, ": "..text)
- return true
- elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("coder") then
- rank_str = "Coder"
- rank_col = Color( 0, 153, 102 )
- bracket_col = Color( 0, 153, 102 )
- chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", color1, prefixText, color2, ": "..text)
- return true
- elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("headadmin") then
- rank_str = "HeadAdmin"
- rank_col = Color( 0, 0, 255 )
- bracket_col = Color( 0, 0, 255 )
- chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", color1, prefixText, color2, ": "..text)
- return true
- else
- rank_str = "User"
- rank_col = Color( 0, 255, 0 )
- bracket_col = Color( 0, 255, 0 )
- chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", color1, prefixText, color2, ": "..text)
- return true
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement