Function
addBan
Bans an IP address, nickname or serial (Client ID) without the player having to be online.
Syntax
ban addBan([string ip = nil, string nick = nil, string serial = nil, player/string responsible = nil, string reason = "", int seconds = 0])Arguments
ipstring, optional = nil- IP address to ban.
nickstring, optional = nil- Nickname to ban.
serialstring, optional = nil- Serial, i.e. the player's Client ID (
TH-XXXX-...). responsibleplayer/string, optional = nil- Who issued the ban: a player or a name.
reasonstring, optional = ""- Reason shown to the player.
secondsint, optional = 0- Ban length in seconds,
0means permanent.
Returns
A ban handle, or false when no IP, nick or serial was given.
Example
A /banserial command that bans a Client ID for 7 days.
addCommandHandler("banserial", function(admin, cmd, serial, ...)
if not serial then
outputChatBox("Użycie: /banserial <Client ID> [powód]", admin)
return
end
local reason = table.concat({...}, " ")
local ban = addBan(nil, nil, serial, admin, reason, 7 * 24 * 60 * 60)
if ban then
outputChatBox("Zbanowano " .. serial .. " na 7 dni.", admin, 0, 255, 0)
end
end)
Notes
One of three is enough. Pass at least an IP, nick or serial and leave the rest as nil.
See also
banPlayerBans a player (their Client ID and IP address) and kicks them right away.removeBanRemoves a ban.getBansReturns every active ban. Bans that have already expired are skipped.isBannedChecks whether a connection with this serial or IP address would be rejected by bans.isBanChecks whether a value is a ban handle.