Help wanted ULX

I need help with adding a reason to !Jail
Example: !jail bob 300 RDM
I know its about putting the codes from kick reason and putting them into jail, but I cant figure it out
if someone somehow could make it so I can add a reason to my !jail

This is KICK luacode

This is jail

I just want an advancded coder to combine them somehow so I can add a reason to my jails.
Thank you

  • New coder

------------------------------ Jail ------------------------------
local doJail
local jailableArea
function ulx.jail( calling_ply, target_plys, seconds, reason, should_unjail )
		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 )
								doJail( v, seconds )
								table.insert( affected_plys, v )
				elseif v.jail then
						v.jail = nil
						table.insert( affected_plys, v )
		if not should_unjail then
				local str = "#A jailed #T"
				if seconds > 0 then
						str = str .. " for #i seconds"
				ulx.fancyLogAdmin( calling_ply, "#A jailed #T for " ..reason.. ".", affected_plys, seconds )
				ulx.fancyLogAdmin( calling_ply, "#A unjailed #T", affected_plys )
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.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine,
completes=ulx.common_kick_reasons }
jail:addParam{ type=ULib.cmds.BoolArg, invisible=true }
jail:defaultAccess( ULib.ACCESS_ADMIN )
jail:help( "Jails target(s)." )
jail:setOpposite( "ulx unjail", {_, _, _, _, true}, "!unjail" )

Next time, try to attempt before asking. I just had to change a few lines around to get this working.

Ur so good, btw It wont show seconds only

"You jailed yourself for NLR"G

Thank you sackcreator54, this really helped me out. But could you maybe do what Crox said
So the seconds also show