Ulysses
General => Developers Corner => Topic started by: Schiaffino on November 28, 2014, 07:02:15 PM
-
Hello guys, well i've seen all the threadas about sourceban here and none of them solve my issue so im wondering if someone can help me to figure this out ?
function ulx.sban( calling_ply, target_ply, minutes, reason )
if target_ply:IsBot() then
ULib.tsayError( calling_ply, "Cannot ban a bot", true )
return
end
SBAN.Player_Ban( target_ply, minutes*60, reason, calling_ply:SteamID() )
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
ULib.queueFunctionCall( ULib.addBan, target_ply, minutes, reason, name, calling_ply )
ulx.fancyLogAdmin( calling_ply, str, target_ply, minutes ~= 0 and minutes or reason, reason )
end
local sban = ulx.command( CATEGORY_NAME, "ulx sban", ulx.sban, "!sban" )
sban:addParam{ type=ULib.cmds.PlayerArg }
sban:addParam{ type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 }
sban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
sban:defaultAccess( ULib.ACCESS_ADMIN )
sban:help( "Bans target." )
This code works 95% the only issue is that when you ban the user instead of giving the user name gives this
(http://i.gyazo.com/c57dfc41f9fa556cce53e96dcb31e47d.png)
And this small error at the console huh
(http://i.gyazo.com/1ae90411baf1d6b77ce49b50696d3982.png)
Sorry for bothering you about this guys but nay help,
Really thanks !
-
After moving the function:
function ulx.sban( calling_ply, target_ply, minutes, reason )
if target_ply:IsBot() then
ULib.tsayError( calling_ply, "Cannot ban a bot", true )
return
end
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 )
ULib.queueFunctionCall( ULib.addBan, target_ply, minutes, reason, name, calling_ply )
SBAN.Player_Ban( target_ply, minutes*60, reason, calling_ply:SteamID() )
end
local sban = ulx.command( CATEGORY_NAME, "ulx sban", ulx.sban, "!sban" )
sban:addParam{ type=ULib.cmds.PlayerArg }
sban:addParam{ type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 }
sban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
sban:defaultAccess( ULib.ACCESS_ADMIN )
sban:help( "Bans target." )
To this position, it works but at sourceban's says "E" ( expired ) inmediately and still the same console error ID error....
-
There are plenty of threads about this. Visit the links below.
You have banned (Console) permanently (reason) (http://forums.ulyssesmod.net/index.php/topic,7453.0.html)
How to update ULX (ULX beginner here!) and get the SVN? (http://forums.ulyssesmod.net/index.php/topic,7560.0.html)
-
The problem is that i'm using the latest revision from the github, downloaded today huh :/
-
Hello there, try this:
function ulx.sban( calling_ply, target_ply, minutes, reason )
if target_ply:IsBot() then
ULib.tsayError( calling_ply, "Cannot ban a bot", true )
return
end
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 )
if calling_ply:IsValid() then
SBAN.Player_Ban( target_ply, minutes*60, reason, calling_ply:SteamID() )
else
SBAN.Player_Ban( target_ply, minutes*60, reason, "STEAM_ID_SERVER")
end
end
local sban = ulx.command( CATEGORY_NAME, "ulx sban", ulx.sban, "!sban" )
sban:addParam{ type=ULib.cmds.PlayerArg }
sban:addParam{ type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 }
sban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons }
sban:defaultAccess( ULib.ACCESS_ADMIN )
sban:help( "Bans target." )
For sourcebans: Try banning longer than a minute and see if the ban expires immediately.
EDIT:
Also in your queued function call, try using the targeted player SteamID instead of the target player. See addBan (http://ulyssesmod.net/docs/files/lua/ulib/server/player-lua.html#addBan)
Avoid
-
Thanks Avoid! did it to implement it to the xgui menu and it works without the ID error now.
The only issue im having is that at SB website its showing "Expire" Inmediately :/ i'll make a few attempts
-
EDIT: Works perfect no ID error but when i set less than 5 hours for some reason it says "E
Really thanks for the quick reply !
-
Hello there,
this is indeed a weird error, make sure you actually use the correct timezone in sourcebans and have a look through your code to see if the time is inserted correctly into the database.
Avoid