Advertisement
AnonGaming

ulx Command Hooks

Feb 2nd, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. UlxHooks = UlxHooks or {}
  2.  
  3. function UlxHooks.setupHooks()
  4.    
  5.     local ulxCommands = ulx.cmdsByCategory
  6.     for k,cat in pairs(ulxCommands) do
  7.         for k,cmd in pairs(cat) do
  8.             local oldFm = cmd.fn
  9.             local cmdNam = string.Replace(cmd.cmd, " ","")
  10.             cmd.fn = function(...)
  11.                 hook.Call(cmdNam,nil,...)
  12.                 return oldFm(...)
  13.             end
  14.         end
  15.     end
  16.     ulx.cmdsByCategory = ulxCommands
  17. end
  18.  
  19. --Usage
  20.  
  21.             hook.Add("ulxadduserid", "timekeepulxadduserid", function(calling_ply,id,group)
  22.                 print("ulx user add by id")
  23.             end)
  24.            
  25.             hook.Add("ulxremoveuserid", "timekeepulxremoveuserid", function(calling_ply,id)
  26.                 print("Ulx Remove user by id")
  27.             end)
  28.            
  29.            
  30.             hook.Add("ulxadduser", "timekeepulxadduser", function(calling_ply,target_ply,group_name)
  31.                 print("Ulx Add User")
  32.             end)
  33.            
  34.             hook.Add("ulxremoveuser", "timekeepulxremoveuser", function(calling_ply,target_ply)
  35.                 print("Ulx Remove User")
  36.             end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement