Guest User

Untitled

a guest
Jul 16th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. -- 1: put this file in lua/autorun/
  2. -- 2: Edit this to match the file name
  3. local filename = "chatranks.lua"
  4.  
  5. if SERVER then
  6.     AddCSLuaFile( "autorun/" .. filename )
  7. else
  8.  
  9.     local function ChatTags( Ply, Txt, TeamChat, IsDead )
  10.         local Msg = {}
  11.          
  12.         -- Dead?
  13.         if IsDead then
  14.             Msg[#Msg+1] = Color( 255, 30, 40 )
  15.             Msg[#Msg+1] = "*DEAD* "
  16.         end
  17.          
  18.         -- Team Chat
  19.         if TeamChat then
  20.             Msg[#Msg+1] = Color( 30, 160, 40 )
  21.             Msg[#Msg+1] = "(TEAM) "
  22.         end
  23.          
  24.         -- Rank
  25.         if Ply:IsSuperAdmin() then
  26.             Msg[#Msg+1] = Color( 255,255,255 )
  27.             Msg[#Msg+1] = "[Super Admin] "
  28.         elseif Ply:IsAdmin() then
  29.             Msg[#Msg+1] = Color( 255,255,255 )
  30.             Msg[#Msg+1] = "[Admin] "
  31.         end
  32.              
  33.         -- Console?
  34.         if IsValid( Ply ) then
  35.             Msg[#Msg+1] = team.GetColor( Ply:Team() )
  36.             Msg[#Msg+1] = Ply:Nick()
  37.         else
  38.             Msg[#Msg+1] = Color( 100, 100, 100)
  39.             Msg[#Msg+1] = "Console"
  40.         end
  41.          
  42.         -- The message
  43.         Msg[#Msg+1] = Color(255,255,255)
  44.         Msg[#Msg+1] = ": " .. Txt
  45.          
  46.         chat.AddText( unpack(Msg) )
  47.         return true
  48.     end
  49.     hook.Add("OnPlayerChat","Simple chat tags",ChatTags)
  50. end
Add Comment
Please, Sign In to add comment