Advertisement
Guest User

Untitled

a guest
Aug 29th, 2014
212
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.  
  19. if ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("owner") then
  20. rank_str = "Owner"
  21. rank_col ord operator">= Color( 0, 0, 232 )
  22. bracket_col ord operator">= Color( 0, 0, 232)
  23.  
  24. elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("Coder") then
  25. rank_str = "Coder"
  26. rank_col = Color( 255, 51, 255 )
  27. bracket_col = Color( 255, 51, 255 )
  28.  
  29. elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("superadmin") then
  30. rank_str = "Super-Admin"
  31. rank_col = Color( 232, 0, 0 )
  32. bracket_col = Color( 232, 0, 0 )
  33.  
  34. elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("admin") then
  35. rank_str = "Admin"
  36. rank_col = Color( 25, 25, 112 )
  37. bracket_col = Color( 25, 25, 112 )
  38.  
  39. elseif ply:IsValid() ="keyword">and ply:IsPlayer() and ply:IsUserGroup("moderator") then
  40. rank_str = "Mod"
  41. rank_col = Color( 0, 101, 0 )
  42. bracket_col = Color( 0, 101, 0 )
  43.  
  44. elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("Donor") then
  45. rank_str = "Donor"
  46. rank_col = Color( 219, 169, 18 )
  47. bracket_col = Color( 219, 169, 18 )
  48.  
  49. elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("user") then
  50. rank_str = "Player"
  51. rank_col = Color( 255, 255, 255 )
  52. bracket_col = Color( 255, 255, 255 )
  53.  
  54. else
  55. rank_str = ""
  56. rank_col = Color( 255, 255, 255 )
  57. end
  58.  
  59. if text and text ~= "" then
  60. chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", col1, name, col2, ": "..text)
  61.  
  62. if IsValid(ply) then
  63. hook.Call("OnPlayerChat", nil, ply, text, false, not ply:Alive())
  64. end
  65. else
  66. chat.AddText(col1, name)
  67. hook.Call("ChatText", nil, "0", name, name, "none")
  68. end
  69. chat.PlaySound()
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement