Skip to content

function getPlayerPosition

This function will get the player world position.
Original: getPlayerPosition

Declaration

async def getPlayerPosition(id : int) -> Optional[tuple]

Parameters

int id: the player id.

Returns

tuple (x, y, z): the player world position.

Source code in src/pyg2o/functions/player.py
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
async def getPlayerPosition(id : int) -> Optional[tuple]:
    """
    This function will get the player world position.
    Original: [getPlayerPosition](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/player/getPlayerPosition/)

    ## Declaration
    ```python
    async def getPlayerPosition(id : int) -> Optional[tuple]
    ```
    ## Parameters
    `int` **id**: the player id.
    ## Returns
    `tuple (x, y, z)`: the player world position.
    """
    data = f'return {get_call_repr()}'

    server = await PythonWebsocketServer.get_server()
    result = await server.make_request(data)
    return (result['x'], result['y'], result['z']) if result is not None else (None, None, None)