Ulysses Stuff > Releases

Sourcebans & ULX/ULib

<< < (3/30) > >>

centran:
Ahh yes... another critical step I failed to mention.
You need the mysqloo module which can be found here http://www.facepunch.com/showthread.php?t=1220537
Windows
Linux

You need to place the mysqloo module in your /lua/bin/ folder

You will also need libMySQL installed wherever you scrds_run file is... linux in the orangebox folder, windows in Steam/steamapps/steam_username/garrysmod
Windows
Linux

Mors Quaedam:
Okay, I've done a crapload of fixes (as you also forgot the gatekeeper), but !sban won't put bans onto the SourceBans database.

Dat empty banlist:


Anyway, I've found the working gatekeeper lua for gmod 13. Place it in srcds/orangebox/garrysmod/lua/includes/modules:


--- Code: ---gatekeeper={}
local spawning={}
 
gameevent.Listen("player_connect")
gameevent.Listen("player_disconnect")
 
function gatekeeper.Drop(userid, reason)
    game.ConsoleCommand(string.format("kickid %d %s\n",userid,reason:gsub(';|\n','')))
end
 
function gatekeeper.GetNumClients()
    local active=#player.GetAll()
    return {spawning=#spawning, active=active, total=#spawning+active}
end
 
function gatekeeper.GetUserByAddress(addr)
    for k,v in pairs(player.GetAll()) do
        if(v:IPAddress()==addr) then
            return v:UserID()
        end
    end
end
 
hook.Add("player_connect", "GateKeeper", function(data)
    local ret=hook.Call("PlayerPasswordAuth", GAMEMODE, data.name, "", data.networkid, data.address)
    print(ret)
    if(type(ret)=="string") then
        gatekeeper.Drop(data.userid, ret)
        return
    elseif(type(ret)=="boolean") then
        if(ret) then
            gatekeeper.Drop(data.userid, "Bad Password")
            return
        end
    end
    table.insert(spawning, data.userid)
end)
 
hook.Add("player_disconnect", "GateKeeper", function(data)
    for k,v in pairs(spawning) do
        if(data.userid==v) then
            table.remove(spawning, k)
            break
        end
    end
end)
 
hook.Add("PlayerInitialSpawn", "GateKeeper", function(ply)
    for k,v in pairs(spawning) do
        if(ply:UserID()==v) then
            table.remove(spawning, k)
            break
        end
    end
end)

function gatekeeper.DropAllClients(reason)
    for k,v in pairs(spawning) do
        gatekeeper.Drop(v, reason)
    end
    for k,v in pairs(player.GetAll()) do
        gatekeeper.Drop(v, reason)
    end
end

--- End code ---

centran:
can you confirm that sourcebans is being loaded properly? you should see it load the admin list in console/logs.
you should also be able to run sm_csay in your game console to verify the admin list was set up and you are in it.

Is there any console/log errors when you try to ban someone?

thegtz:

--- Quote from: centran on December 09, 2012, 05:02:03 PM ---Don't use it. You don't need it.

Replace line 25 of sourcebans.lua with this

--- Code: -----require("gatekeeper");

--- End code ---

--- End quote ---

Thanks. Seems to be working perfectly now.

Mors Quaedam:
Worked for about a minute, after installing SB module on other two gmod servers, all 3 servers (and the TF2 server) stopped contacting the MySQL server and can no longer sm_rehash.

Edit: Never mind, I fixed it.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version