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
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
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.