Here you go.
function ulx.cc_ban2( ply, command, argv, args )
if #argv < 1 then
ULib.tsay( ply, ulx.LOW_ARGS, true )
return
end
local target, err = ULib.getUser( argv[ 1 ], _, ply )
if not target then
ULib.tsay( ply, err, true )
return
end
local bantime = tonumber( argv[ 2 ] ) or 0
if bantime == 0 then
ULib.tsay( ply, "This ban is not allowed to ban perminently", true )
return
end
if bantime > 4320 then
ULib.tsay( ply, "This ban is not allowed to ban for longer than 3 days", true )
return
end
local dummy, dummy, reason = args:find( "^\"*" .. ULib.makePatternSafe( argv[ 1 ] ) .. "\"*%s+" .. ULib.makePatternSafe( argv[ 2 ] ) .. "%s+(.*)$" )
reason = reason or "" -- Make sure it has a value
local time = "for " .. bantime .. " minute(s)"
if reason ~= "" then reason = "(" .. reason .. ")" end
ulx.logUserAct( ply, target, "#A banned #T " .. time .. " " .. reason )
ULib.kickban( target, bantime, reason, ply )
end
ulx.concommand( "ban2", ulx.cc_ban2, "<user> [<time>] [<reason>] - Bans a user for x minutes, Must be less than 4320 minutes(3 Days).", ULib.ACCESS_ADMIN, "!ban2", _, ulx.ID_PLAYER_HELP )
All I did was add 2 time checks =)
ulx ban2 <user> <time> <reason> (!ban2)
This ban can not ban for 0 minutes (perminently).. if you try it will tell you you cant and exit the function
This ban can not ban for more than 3 days.. if you try it will tell you it cant, and exit the function.
If you want to call it something else.. like aban or oban.. or whatever.. just open the lua file in notepad and replace all 4 instances of ban2 with whatever you want it to be called. The Find and Replace function under Edit works wonders for this! =)
Download below..
oh btw.. drop this in Addons/ULX/Lua/ULX/Modules