Advertisement
Guest User

Gmod Snippet

a guest
Apr 26th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. if CLIENT then
  2.     net.Receive("adminRequest", function( len )
  3.         local message = net.ReadString()
  4.         local ply = net.ReadEntity()
  5.         local admins = {"superadmin", "admin", "moderator"}
  6.        
  7.         if IsValid(LocalPlayer()) and table.HasValue(admins, LocalPlayer():GetUserGroup()) then
  8.            
  9.             chat.AddText( Color( 171, 0, 255, 255), "=============[", Color( 255, 255, 255, 255), "Case Received", Color( 171, 0, 255, 255), "]=============")
  10.             chat.AddText( Color( 0, 255, 0, 255), ply:Nick(), Color( 255, 255, 255, 255), ":")
  11.            
  12.             chat.AddText( Color( 255, 255, 255, 255), message)
  13.             chat.AddText( Color( 171, 0, 255, 255), "============================")
  14.            
  15.            
  16.         end
  17.     end)
  18.  
  19. end
  20.  
  21. if SERVER then
  22.     util.AddNetworkString("adminRequest")
  23.  
  24.         hook.Add( "PlayerSay", "Admin Request", function( ply, text )
  25.  
  26.         local phrase = "@"
  27.         local message = ""
  28.         local cmd = ""
  29.        
  30.         if string.match(text, phrase) == phrase then
  31.        
  32.             cmd = phrase
  33.             message = string.Replace( text, phrase, "")
  34.  
  35.         end
  36.        
  37.         if string.lower(cmd) == string.lower(phrase) then
  38.             net.Start("adminRequest")
  39.             net.WriteString(message)
  40.             net.WriteEntity(ply)
  41.             net.Send(ply)
  42.            
  43.             return ""
  44.         end
  45.     end)
  46.  
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement