Skip to content

function addBan

Note

All properties should be of primitive types and are optional, but you still need to provide at least one of them.

Note

The reason string can't be longer than 255 characters.

Note

The meta table is used for storing custom data.

This function will add a new ban on the server.
Original: addBan

Declaration

async def addBan(info : dict) -> bool

Parameters

dict {serial, mac, ip, name, reason, timestamp, meta={..}} info: the ban properties.
int host_id: the player host identifier.

Returns

bool: true if ban was added, otherwise false.

Source code in src/pyg2o/functions/player.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
async def addBan(info : dict) -> bool:
    """
    !!! note
        All properties should be of primitive types and are optional, but you still need to provide at least one of them.
    !!! note
        The reason string can't be longer than 255 characters.
    !!! note
        The meta table is used for storing custom data.
    This function will add a new ban on the server.
    Original: [addBan](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/player/addBan/)

    ## Declaration
    ```python
    async def addBan(info : dict) -> bool
    ```
    ## Parameters
    `dict {serial, mac, ip, name, reason, timestamp, meta={..}}` **info**: the ban properties.
    `int` **host_id**: the player host identifier.
    ## Returns
    `bool`: `true` if ban was added, otherwise `false`.
    """
    data = f'return {get_call_repr()}'

    server = await PythonWebsocketServer.get_server()
    result = await server.make_request(data)
    return result