Completely untested.. but this "should" world...
Replace the functions for ban and banid inside of your ulx\modules\sh.lua file
function ulx.ban( calling_ply, target_ply, time, reason )
if target_ply:IsBot() then
ULib.tsayError( calling_ply, "Cannot ban a bot", true )
return
end
if time == "" then
ULib.tsayError( calling_ply, "You must enter a value for time.", true )
return
end
local minutes = ULib.stringTimeToSeconds( time )
if not minutes then
ULib.tsayError( calling_ply, "Invalid time format." )
return
end
ULib.kickban( target_ply, minutes, reason, calling_ply )
local time = "for #i minute(s)"
if minutes == 0 then time = "permanently" end
local str = "#A banned #T " .. time
if reason and reason ~= "" then str = str .. " (#s)" end
ulx.fancyLogAdmin( calling_ply, str, target_ply, minutes ~= 0 and minutes or reason, reason )
end
local ban = ulx.command( CATEGORY_NAME, "ulx ban", ulx.ban, "!ban" )
ban:addParam{ type=ULib.cmds.PlayerArg }
ban:addParam{ type=ULib.cmds.StringArg, hint="minutes, 0 for perma. 'h' for hours, 'd' for days, 'w' for weeks. EG, '2w5d' for 2 weeks 5 days", ULib.cmds.optional }
ban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
ban:defaultAccess( ULib.ACCESS_ADMIN )
ban:help( "Bans target." )
function ulx.banid( calling_ply, steamid, time, reason )
if time == "" then
ULib.tsayError( calling_ply, "You must enter a value for time.", true )
return
end
steamid = steamid:upper()
if not ULib.isValidSteamID( steamid ) then
ULib.tsayError( calling_ply, "Invalid steamid." )
return
end
local minutes = ULib.stringTimeToSeconds( time )
if not minutes then
ULib.tsayError( calling_ply, "Invalid time format." )
return
end
local name
local plys = player.GetAll()
for i=1, #plys do
if plys[ i ]:SteamID() == steamid then
name = plys[ i ]:Nick()
break
end
end
ULib.addBan( steamid, minutes, reason, name, calling_ply )
local time = "for #i minute(s)"
if minutes == 0 then time = "permanently" end
local str = "#A banned steamid #s "
if name then
steamid = steamid .. "(" .. name .. ") "
end
str = str .. time
if reason and reason ~= "" then str = str .. " (#4s)" end
ulx.fancyLogAdmin( calling_ply, str, steamid, minutes ~= 0 and minutes or reason, reason )
end
local banid = ulx.command( CATEGORY_NAME, "ulx banid", ulx.banid )
banid:addParam{ type=ULib.cmds.StringArg, hint="steamid" }
banid:addParam{ type=ULib.cmds.StringArg, hint="minutes, 0 for perma. 'h' for hours, 'd' for days, 'w' for weeks. EG, '2w5d' for 2 weeks 5 days", ULib.cmds.optional }
banid:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
banid:defaultAccess( ULib.ACCESS_SUPERADMIN )
banid:help( "Bans steamid." )