Pivity

ULX addition help

Last read Never
#1

Greetings.

So, I have a guard ban script that bans people from guard for two hours. Just out of interest, what would I need to add/remove 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

Thanks.

Original GitHUB repository Code:

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 );
else
ULib.tsayError(calling_ply, "That player is not guardbanned!", true);
end
else
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:SetTeam(TEAM_PRISONER);
target_ply:KillSilent();
target_ply:SendNotification("You have been banned from Guards");
end
end
else
ULib.tsayError(calling_ply, error_not_jailbreak, true);
end
end
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.")
else
ULib.tsayError(calling_ply, target_ply:Name() .. " is not guardbanned!")
end
else
ULib.tsayError(calling_ply, error_not_jailbreak, true);
end
end
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:SetTeam(TEAM_PRISONER);
player:KillSilent();
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
end )

P.S. Only post if you're gonna help, fanx <3

Edited Anyone willing to help me out here, I have a little extra part (Web side) that i'd like done - very basic - for $7.50 If you wanna help out on the webside, just PM me on here, or add me on steam

#2

do you want the reason to just print in chat or some shit

Friendly x 1
#3
Bydrizzy.vip - cridentat 4th of October 2017 15:49:45
do you want the reason to just print in chat or some shit

Yes - The reason will later need to be taken and printed also onto a list on my website (Much like Sourcebans), however for now, just to chat

Optimistic x 1
Users viewing this thread
Nobody