Jailbreak 7 ULX guard ban


So, I have a gaurd ban script that bans people from guard for two hours.
Just out of interest, what would I need to add to the code to force administrators to add a reason, or maybe a custom time instead of the set two hours.
If you’re feeling spicy, maybe you could help with a simple web side to this where people can see who was guard banned, for how long and the reason


Original GitHUB repository

local error_not_jailbreak = "The current gamemode is not jailbreak!"

function ulx.guardban( calling_ply, target_ply, unban )
	if GAMEMODE_NAME == "jailbreak" then
		if unban then
			if tonumber(target_ply:GetPData( "guardbanned", 0 )) > os.time() then
				target_ply:RemovePData( "guardbanned" )
				target_ply:RemovePData( "guardbanned_on" )
				target_ply:RemovePData( "guardbanned_by" )
				ulx.fancyLogAdmin( calling_ply, "#A unbanned #T from guards",  target_ply );
				ULib.tsayError(calling_ply, "That player is not guardbanned!", true);
			target_ply:SetPData( "guardbanned", os.time()+7200 )
			target_ply:SetPData( "guardbanned_on", os.time() )
			target_ply:SetPData( "guardbanned_by", string.format( "%s (%s)", calling_ply:Name(), calling_ply:SteamID()))
			ulx.fancyLogAdmin( calling_ply, "#A banned #T from guards",  target_ply );
			if target_ply:Team() == TEAM_GUARD then
				target_ply:SendNotification("You have been banned from Guards");
		ULib.tsayError(calling_ply, error_not_jailbreak, true);
local guardban = ulx.command("Jailbreak", "ulx guardban", ulx.guardban, "!guardban" )
guardban:defaultAccess( ULib.ACCESS_ADMIN )
guardban:addParam{ type=ULib.cmds.PlayerArg }
guardban:addParam{ type=ULib.cmds.BoolArg, invisible=true }
guardban:setOpposite( "ulx unguardban", { _, _, true }, {"!unguardban", "!guardunban"} )
guardban:help( "Bans target from guards for 2 hours." )

function ulx.guardbaninfo( calling_ply, target_ply)
	if GAMEMODE_NAME == "jailbreak" then
		if tonumber(target_ply:GetPData( "guardbanned", 0 )) > os.time() then
			ULib.tsay( calling_ply, target_ply:Name() .. " was guardbanned by " .. target_ply:GetPData( "guardbanned_by", "an unknown person" ) .. ".")
			ULib.tsay( calling_ply, "The ban was issued about " .. math.Round((os.time()-target_ply:GetPData( "guardbanned_on", 0 ))/60) .. " minutes ago and will expire in about " .. math.Round((target_ply:GetPData( "guardbanned", 0 )-os.time())/60) .. " minutes.")
			ULib.tsayError(calling_ply, target_ply:Name() .. " is not guardbanned!")
		ULib.tsayError(calling_ply, error_not_jailbreak, true);
local guardbaninfo = ulx.command("Jailbreak", "ulx guardbaninfo", ulx.guardbaninfo, {"!guardbaninfo", "!gbinfo"}, true )
guardbaninfo:defaultAccess( ULib.ACCESS_ADMIN )
guardbaninfo:addParam{ type=ULib.cmds.PlayerArg }
guardbaninfo:help( "Prints info about a guardban." )

hook.Add( "JailBreakPlayerSwitchTeam", "jbulx_JailBreakPlayerSwitchTeam", function(player, team)
	if tonumber(player:GetPData( "guardbanned", 0 )) > os.time() and team == TEAM_GUARD then
		player:SendNotification("You have been banned from Guards");
		ULib.tsayError(player, "You are banned from joining guards! You will be unbanned in about " .. math.Round((player:GetPData( "guardbanned", 0 )-os.time())/60) .. " minutes.")
		ulx.fancyLogAdmin( nil, true,  "#T attemped to join guards while guardbanned.", player)
end )

P.S. I’m only interested in people who are gonna help.

To accomplish this you can perfectly take a look at ULX default commands, as perhaps Kick for the reason adding and the ban commands for optional reasons/ban time.

My issue is, knowing where to add the additional code, and what current code to remove

Each parameter adds a new argument to the commands function, and if its an optional value then if that value isn’t supplied that parameter will have a nil in its place.
You’d also have to add the time supplied instead of the default 7200 seconds on line 15.

You should modify it by yourself, nobody in here is going to modify it for you.

Okay, thanks.
I’ll just use trial and error.