Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. -- Add the ranks
  2. local usergroups = {}
  3.  
  4. local customtitles = {}
  5. customtitles["STEAM_0:1:69148762"] = {"1337Hopper", Color(255, 255, 255)}
  6.  
  7. usergroups[1] = {"Owner", "Owner", Color(85,0,150)}
  8. usergroups[2] = {"Developer", "Developer", Color(1100,200,255)}
  9. usergroups[3] = {"superadmin", "S-Admin", Color(180,50,100)}
  10. usergroups[4] = {"admin", "Admin", Color(255,150,50)}
  11. usergroups[5] = {"DAdmin", "Admin:money:", Color(255,17,17)}
  12. usergroups[6] = {"Moderator", "Mod", Color(0,0,255)}
  13. usergroups[7] = {"DMod", "Mod:money:", Color(0,0,255)}
  14. usergroups[8] = {"Trusted", "Trusted", Color(255,127,0)}
  15. usergroups[9] = {"DTrusted", "Trusted:money:", Color(255,127,0)}
  16. usergroups[10] = {"Donator", "Donator", Color(100,200,50)}
  17.  
  18. local mycolors = {}
  19. mycolors[1] = Color(255, 0, 0)
  20. mycolors[2] = Color(255, 127, 0)
  21. mycolors[3] = Color(255, 255, 0)
  22. mycolors[4] = Color(0, 255, 0)
  23. mycolors[5] = Color(0, 0, 255)
  24. mycolors[6] = Color(75, 0, 130)
  25. mycolors[7] = Color(143, 0, 255)
  26.  
  27. -- Main function
  28. hook.Add("OnPlayerChat", "ranks:OnPlayerChat", function(player, text, plyteam, dead)
  29. -- Keep track
  30. local tab = {}
  31. local i = 0
  32.  
  33. -- Console and such
  34. if (player:IsValid()) then
  35.  
  36. -- Just finding
  37. local title = customtitles[player:SteamID()]
  38.  
  39. if customtitles[player:SteamID()] then
  40. table.insert(tab, color_white)
  41. table.insert(tab, "[")
  42.  
  43. for k, v in pairs(string.Explode("", title[1])) do
  44. i = i + 1
  45.  
  46. if (i >= #mycolors) then
  47. i = 0
  48. end
  49. table.insert(tab, mycolors[i])
  50. table.insert(tab, v)
  51. end
  52.  
  53. table.insert(tab, color_white)
  54. table.insert(tab, "] ")
  55. else
  56. for k, v in pairs(usergroups) do
  57. if (player:IsUserGroup(v[1])) then
  58. table.insert(tab, color_white)
  59. table.insert(tab, "[")
  60. table.insert(tab, v[3])
  61. table.insert(tab, v[2])
  62. table.insert(tab, color_white)
  63. table.insert(tab, "] ")
  64. break
  65. end
  66. end
  67. end
  68.  
  69. -- lets see if this works!
  70.  
  71. table.insert(tab, color_white)
  72. table.insert(tab, "[")
  73. table.insert(tab, player:GetBhopRankColor())
  74. table.insert(tab, player:GetBhopRankName())
  75. table.insert(tab, color_white)
  76. table.insert(tab, "] ")
  77.  
  78. local teamcolor = team.GetColor(player:Team())
  79. -- Player name
  80. table.insert(tab, teamcolor)
  81. table.insert(tab, player:Name())
  82. else
  83. -- Console
  84. table.insert(tab, color_white)
  85. table.insert(tab, "Console")
  86. end
  87.  
  88. -- Text
  89. table.insert(tab, color_white)
  90. table.insert(tab, ": "..text)
  91.  
  92.  
  93.  
  94. -- Finally
  95. chat.AddText(unpack(tab))
  96. return true
  97. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement