Guest User

Untitled

a guest
Aug 23rd, 2013
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. local doJail
  2. local jailableArea
  3. function ulx.jail( calling_ply, target_plys, seconds, reason, should_unjail)
  4. local affected_plys = {}
  5. for i=1, #target_plys do
  6. local v = target_plys[ i ]
  7.  
  8. if not should_unjail then
  9. if ulx.getExclusive( v, calling_ply ) then
  10. ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
  11. elseif not jailableArea( v:GetPos() ) then
  12. ULib.tsayError( calling_ply, v:Nick() .. " is not in an area where a jail can be placed!", true )
  13. else
  14. doJail( v, seconds)
  15.  
  16. table.insert( affected_plys, v )
  17. end
  18. elseif v.jail then
  19. v.jail.unjail()
  20. v.jail = nil
  21. table.insert( affected_plys, v )
  22. end
  23. end
  24.  
  25. if not should_unjail then
  26. local str = "#A jailed #T"
  27. if seconds > 0 then
  28. str = str .. " for #i seconds"
  29. end
  30. if reason and reason ~= "" then str = str .. " (#s)" end
  31. ulx.fancyLogAdmin( calling_ply, str, target_ply, seconds ~= 0 or reason, reason )
  32. end
  33. end
  34.  
  35. local jail = ulx.command( CATEGORY_NAME, "ulx jail", ulx.jail, "!jail" )
  36. jail:addParam{ type=ULib.cmds.PlayersArg }
  37. jail:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, 0 is forever", ULib.cmds.round, ULib.cmds.optional }
  38. jail:addParam{ type=ULib.cmds.BoolArg, invisible=true }
  39. jail:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
  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