Ulysses Stuff > Releases

UBan -- Global ban system. Ban users from all servers connected to a single DB!

<< < (39/40) > >>

Bite That Apple:
I just debugged the crap out of this, and I seem to get an error at line 188 which is at the end of the uban.lua.

I'm just going to post the whole function to see if anyone can find out why it's not working. If you need the uban.lua it's in a attachment


This is not the whole code

--- Code: ---function DoBans()

local Qc = server:query("SELECT steamid, TIME_TO_SEC( TIMEDIFF( unban_time, NOW() ) ) as timeleft FROM " .. table .. " WHERE NOW() < unban_time OR unban_time = 0")
    Qc.onSuccess = function(data)
Msg("Successfully Connected - Line 138\n")
local results = data:getData()

local steamids = {}

for _, t in ipairs( results ) do
local steamid = t.steamid

local time = t.timeleft
if not time or time == 0 then
time = baninterval
else
time = math.min( time / 60, baninterval )
end

steamids[ steamid ] = math.max( time, steamids[ steamid ] or 0 ) -- We're doing this so oddly so we can catch multiple results and use the largest one.
end

-- We're using this following chunk of code to identify current steamids in the server
local cursteamids = {}
local players = player.GetAll()
for _, ply in ipairs( players ) do
cursteamids[ ply:SteamID() ] = ply
end

for steamid, time in pairs( steamids ) do -- loop through all currently banned ids
if cursteamids[ steamid ] then -- Currently connected
local str = string.format( "kickid %s Banned on global ban list\n", steamid )
game.ConsoleCommand( str )
Bans[ steamid ] = nil -- Clear their ban info to make sure they get banned. (A 'reban' should only ever arise if console removeid's a steamid)
end

if not Bans[ steamid ] or Bans[ steamid ] < time or Bans[ steamid ] > time + baninterval * 2 then -- If we don't already have them marked as banned or it's a new time
local str = string.format( "banid %f %s kick\n", time, steamid )
game.ConsoleCommand( str )
-- print( str ) -- For debug
end
Bans[ steamid ] = time
end

for steamid in pairs( Bans ) do -- loop through all recorded bans
if not steamids[ steamid ] then -- If they're not on the ban list we just pulled off the server, they're out of jail!
game.ConsoleCommand( "removeid " .. steamid .. "\n" )
Bans[ steamid ] = nil
end
end


end
Qc.onFailure = function(Err) print(Err) end
Msg("Failed to Connect - Line 188\n")
    Qc:start()



end

--- End code ---



EDIT:

I tested it so more, and I found that the whole thing just "doesn't connect" let alone work. It just has problems connecting. I mean it's not like it ISN'T connecting, because if you make a bot it will say it successfully connected, but it just doesn't work.

Marmaduke:
So, does anyone know how to get this working on Gmod13? when I ban myself it says i'm global banned, and when I try to reconnect it tells me i'm banned, except when I look at the database there is no new entry, even after the specified "0.25 minutes".
When I try to gbanid, it says:

"Global ban failed! See server console for error."

When the server console is checked it says:

"UBan failure. Error is: lua/autorun/server/uban.lua:96: attempt to index local 'Qc' (a nil value)"

I have no idea what this error is, nor how to fix it. 'Anyone know the fix? I'm using saintwubbles version.

Thanks

Eccid:
It doesn't work on gmod 13, this does.

Moka:
Cant seem to connect to my database. Even tried a different web host.

Eccid:
The last post on this by a ulysses member was in 2011. It doesn't work anymore. Go to the link I posted above and use that one, or try the sourcebans one, both work just fine.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version