ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. addBan

Function

addBan

ServerAdministration and bansIdentical to MTA:SA

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, 0 means 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