Jump to content

Recommended Posts

-- customcommands.lua

-- Returns a boolean depending on success of the operation.
function c_unban(userid)
    if type(userid) ~= "string" then
        print("[Error] Missing #1 argument (userid).")

        return false
    end

    local blacklist = TheNet:GetBlacklist()
    for i, record in ipairs(blacklist) do
        if not record.empty and (record.userid == userid or record.netid == userid) then
            table.remove(blacklist, i)

            TheNet:SetBlacklist(blacklist)
            print(userid.." was removed from the blacklist.")

            return true
        end
    end

    print("[Error] "..userid.." not found.")
    return false
end

Here you go. A complete c_unban custom command.

Works for both, Klei ID's and Steam ID's. Returns a boolean depending on success of the operation, so this can be used in some fancy automation scripts.

No server restart is needed. The banned player can join immediately after this command is executed. blocklist.txt is updated as well.

Use with care :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...