Advertisement
Guest User

chattags

a guest
Dec 1st, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. ------------------------------------
  2. -- This file holds the chat tags --
  3. -------------------------------------
  4.  
  5. if ( SERVER ) then
  6.  
  7. AddCSLuaFile( )
  8.  
  9. return
  10.  
  11. end
  12.  
  13. if ( CLIENT ) then
  14.  
  15. local string = string
  16.  
  17. local str = string
  18.  
  19. local str2
  20.  
  21. local TagColor = {}
  22.  
  23. --TagColor["YourCustomUsergroupNameHere"] = Color( red, green, blue )
  24.  
  25. TagColor["Owner"] = Color( 127, 0, 255 )
  26.  
  27. TagColor["Co-Owner"] = Color( 127, 0, 255 )
  28.  
  29. TagColor["Head Admin"] = Color( 0, 0, 204 )
  30.  
  31. TagColor["Super Admin"] = Color( 255, 0, 0 )
  32.  
  33. TagColor["Admin"] = Color( 255, 128, 0 )
  34.  
  35. TagColor["Moderator"] = Color( 178, 102, 255 )
  36.  
  37. TagColor["Developer"] = Color( 255, 0, 0 )
  38.  
  39. TagColor["VIP"] = Color( 255, 255, 0 )
  40.  
  41. local function OnPlayerChat( ply, strText, bTeamOnly, bPlayerIsDead )
  42.  
  43. local tab = {}
  44.  
  45. local defcol = Color( 0, 201, 0 )
  46.  
  47. if ( bPlayerIsDead ) then
  48.  
  49. table.insert( tab, Color( 255, 30, 40 ) )
  50.  
  51. table.insert( tab, "*DEAD* " )
  52.  
  53. end
  54.  
  55. if ( bTeamOnly ) then
  56.  
  57. table.insert( tab, Color( 30, 160, 40 ) )
  58.  
  59. table.insert( tab, "(TEAM) " )
  60.  
  61. end
  62.  
  63. if ( IsValid( ply ) ) then
  64.  
  65. if ( ply.GetUserGroup ) then
  66.  
  67. if ( ply:GetUserGroup() ~= "user" ) then
  68.  
  69. table.insert( tab, TagColor[ ply:GetUserGroup() ] or Color( 255, 255, 255 ) )
  70.  
  71. str = ply:GetUserGroup()
  72.  
  73. str2 = str
  74.  
  75. if string.find( str2, "%s" ) then
  76.  
  77. string.sub( str2, string.find( str2, "%s" ), string.len( str2 ) )
  78.  
  79. str2 = str2:gsub( "^%l", string.upper )
  80.  
  81. end
  82.  
  83. str = str:gsub( "^%l", string.upper )
  84.  
  85. table.insert( tab, "[" .. str .. "] " )
  86.  
  87. end
  88.  
  89. end
  90.  
  91. table.insert( tab, defcol )
  92.  
  93. table.insert( tab, ply:GetName() )
  94.  
  95. else
  96.  
  97. table.insert( tab, "Console" )
  98.  
  99. end
  100.  
  101. table.insert( tab, Color( 255, 255, 255 ) )
  102.  
  103. table.insert( tab, ": "..strText )
  104.  
  105. chat.AddText( unpack( tab ) )
  106.  
  107. return true
  108.  
  109. end
  110. hook.Add( "OnPlayerChat", "Tags.OnPlayerChat", OnPlayerChat )
  111.  
  112. end --End clientside
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement