Skip to content

function getPlayerContext

This function is used to get player script context. For more information see this article.
Original: getPlayerContext

Declaration

async def getPlayerContext(id : int, type : int) -> int

Parameters

int id: the player id.

Returns

int: the value stored within selected context.

Source code in src/pyg2o/functions/player.py
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
async def getPlayerContext(id : int, type : int) -> int:
    """
    This function is used to get player script context. For more information see [this article](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/multiplayer/script-context/).
    Original: [getPlayerContext](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/player/getPlayerContext/)

    ## Declaration
    ```python
    async def getPlayerContext(id : int, type : int) -> int
    ```
    ## Parameters
    `int` **id**: the player id.
    ## Returns
    `int`: the value stored within selected context.
    """
    data = f'return {get_call_repr()}'

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