Advertisement
Guest User

Chat Tags

a guest
Aug 29th, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. -- rank_str is the prefix shown before the players name, rank_col and bracket_col are colors obviously (RGB).
  2. local function AddToChat(msg)
  3. local col1 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
  4.  
  5. local name = msg:ReadString()
  6. local ply = msg:ReadEntity()
  7. ply = IsValid(ply) and ply or LocalPlayer()
  8.  
  9. if name == "" or not name then
  10. name = ply:Nick()
  11. name = name ~= "" and name or ply:SteamName()
  12. end
  13.  
  14. local col2 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
  15.  
  16. local text = msg:ReadString()
  17. local rank_str, rank_col, bracket_col
  18. if ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("owner") then
  19. rank_str = "Owner"
  20. rank_col ord operator">= Color( 0, 0, 232 )
  21. bracket_col ord operator">= Color( 0, 0, 232)
  22. elseif ply:IsValid() ord">and ply:IsPlayer() and ply:IsUserGroup("coder") then
  23. rank_str = "Coder"
  24. rank_col = Color( 255, 51, 255 )
  25. bracket_col = Color( 255, 51, 255 )
  26. elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("superadmin") then
  27. rank_str = "Super-Admin"
  28. rank_col = Color( 232, 0, 0 )
  29. bracket_col = Color( 232, 0, 0 )
  30. ="keyword">elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("admin") then
  31. rank_str = "Admin"
  32. rank_col = Color( 25, 25, 112 )
  33. bracket_col = Color( 25, 25, 112 )
  34. ="keyword">elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("moderator") then
  35. rank_str = "Mod"
  36. rank_col = Color( 0, 101, 0 )
  37. bracket_col = Color( 0, 101, 0 )
  38. elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("Donor") then
  39. rank_str = "Donor"
  40. rank_col = Color( 219, 169, 18 )
  41. bracket_col = Color( 219, 169, 18 )
  42. elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("user") then
  43. rank_str = "Player"
  44. rank_col = Color( 255, 255, 255 )
  45. bracket_col = Color( 255, 255, 255 )
  46. else
  47. rank_str = ""
  48. rank_col = Color( 255, 255, 255 )
  49. end
  50. if text and text ~= "" then
  51. function">chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", col1, name, col2, ": "..text)
  52. if IsValid(ply) then
  53. hook.Call("OnPlayerChat", nil, ply, text, false, not ply:Alive())
  54. end
  55. else
  56. chat.AddText(col1, name)
  57. hook.Call("ChatText", nil, "0", name, name, "none")
  58. end
  59. chat.PlaySound()
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement