ULX

Author Topic: ULX jail  (Read 1679 times)

0 Members and 1 Guest are viewing this topic.

Offline XeanWolf20

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
ULX jail
« on: October 13, 2017, 03:30:12 PM »
Hey so i have a server and i had it where you could add reasons to jail, now i can't.

I would like it to look like:

You jailed Yourself for 1 second (You are stupid)

ban looks like:

You banned Yourself permanently (reason)

I want my jail like that but not with ban in?

Code: [Select]
local doJail
local jailableArea
function ulx.jail( calling_ply, target_plys, seconds, should_unjail, reason )
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]

if not should_unjail then
if ulx.getExclusive( v, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
elseif not jailableArea( v:GetPos() ) then
ULib.tsayError( calling_ply, v:Nick() .. " is not in an area where a jail can be placed!", true )
else
doJail( v, seconds )

table.insert( affected_plys, v )
end
elseif v.jail then
v.jail.unjail()
v.jail = nil
table.insert( affected_plys, v )
end
end

if not should_unjail then
local str = "#A jailed #T"
if seconds > 0 then
str = str .. " for #i seconds for"  .. reason
end
if reason and reason ~= "" then str = str .. " (#s)" end
ulx.fancyLogAdmin( calling_ply, str, affected_plys, seconds, reason )
else
ulx.fancyLogAdmin( calling_ply, "#A unjailed #T", affected_plys, reason )
end
end

local jail = ulx.command( CATEGORY_NAME, "ulx jail", ulx.jail, "!jail" )
jail:addParam{ type=ULib.cmds.PlayersArg }
jail:addParam{ type=ULib.cmds.NumArg, min=0, default=0, hint="seconds, 0 is forever", ULib.cmds.round, ULib.cmds.optional }
jail:addParam{ type=ULib.cmds.BoolArg, invisible=true }
jail:defaultAccess( ULib.ACCESS_ADMIN )
jail:help( "Jails target(s)." )
jail:setOpposite( "ulx unjail", {_, _, _, true}, "!unjail" )

This is what I have ATM, I added reason in the main function and to the fancyadmin thing, and now it doesn't say a thing in chat when O jail myself....



Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: ULX jail
« Reply #1 on: October 13, 2017, 04:22:03 PM »
You don't have a StringArg set. Without the Parameter, you're trying to use a nil value. If you check your server's console when you use the command you'd see that.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.