JamminR, when the console runs the command does calling_ply:IsPlayer() return false?
Because if it does like I assume the following script should work.
-- ULX sban for ULX SVN/ULib SVN by HeLLFox_15
-- Special Thanks to: Hymsan, JamminR, Strategos, Sonicscream, and Blackfire88
function ulx.sban( calling_ply, target_ply, time, reason )
if target_ply:IsBot() then
ULib.tsayError( calling_ply, "Cannot ban a bot", 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 calling_admin = calling_ply
if not calling_ply:IsPlayer() then
calling_admin = nil
return
end
sourcebans.BanPlayer( target_ply, minutes*60, reason, calling_admin )
local time = "for #i minute(s)"
if minutes == 0 then time = "permanently" end
local str = "#A source 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 sban = ulx.command( "Utility", "ulx sban", ulx.sban, "!sban" )
sban:addParam{ type=ULib.cmds.PlayerArg }
sban: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 }
sban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
sban:defaultAccess( ULib.ACCESS_SUPERADMIN )
sban:help( "Bans a target and adds them to the source bans list." )
Please notice the small block of code that I added before calling the sourcebans.BanPlayer function.
local calling_admin = calling_ply
if not calling_ply:IsPlayer() then
calling_admin = nil
return
end
sourcebans.BanPlayer( target_ply, minutes*60, reason, calling_admin )
I am going to get this tested later on in the day, and get back to this post with the results.