Advertisement
Guest User

ULX adminmod jail

a guest
Aug 23rd, 2013
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. ------------------------------ Jail ------------------------------
  2. local doJail
  3. local jailableArea
  4. function ulx.jail( calling_ply, target_plys, seconds, should_unjail)
  5. local affected_plys = {}
  6. for i=1, #target_plys do
  7. local v = target_plys[ i ]
  8.  
  9. if not should_unjail then
  10. if ulx.getExclusive( v, calling_ply ) then
  11. ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
  12. elseif not jailableArea( v:GetPos() ) then
  13. ULib.tsayError( calling_ply, v:Nick() .. " is not in an area where a jail can be placed!", true )
  14. else
  15. doJail( v, seconds)
  16.  
  17. table.insert( affected_plys, v )
  18. end
  19. elseif v.jail then
  20. v.jail.unjail()
  21. v.jail = nil
  22. table.insert( affected_plys, v )
  23. end
  24. end
  25.  
  26. if not should_unjail then
  27. local str = "#A jailed #T"
  28. if seconds > 0 then
  29. str = str .. " for #i seconds"
  30. end
  31. ulx.fancyLogAdmin( calling_ply, str, affected_plys, seconds )
  32. else
  33. ulx.fancyLogAdmin( calling_ply, "#A unjailed #T", affected_plys )
  34. end
  35. end
  36. local jail = ulx.command( CATEGORY_NAME, "ulx jail", ulx.jail, "!jail" )
  37. jail:addParam{ type=ULib.cmds.PlayersArg }
  38. jail:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, 0 is forever", ULib.cmds.round, ULib.cmds.optional }
  39. jail:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  40. jail:defaultAccess( ULib.ACCESS_ADMIN )
  41. jail:help( "Jails target(s)." )
  42. jail:setOpposite( "ulx unjail", {_, _, _, true}, "!unjail" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement