Skip to content

function hitPlayer

This function is used to simulate hit between attacker and victim. It will only work with if killer or victim is a real player. The victim will receive damage calculated damage by the game.
Original: hitPlayer

Declaration

async def hitPlayer(id : int, target_id : int) -> bool

Parameters

int id: the player id.
int target_id: the victim id.

Returns

bool: true if hit was successfully simulated, otherwise false.

Source code in src/pyg2o/functions/player.py
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
async def hitPlayer(id : int, target_id : int) -> bool:
    """
    This function is used to simulate hit between attacker and victim. It will only work with if killer or victim is a real player. The victim will receive damage calculated damage by the game.
    Original: [hitPlayer](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/player/hitPlayer/)

    ## Declaration
    ```python
    async def hitPlayer(id : int, target_id : int) -> bool
    ```
    ## Parameters
    `int` **id**: the player id.
    `int` **target_id**: the victim id.
    ## Returns
    `bool`: `true` if hit was successfully simulated, otherwise `false`.
    """
    data = f'return {get_call_repr()}'

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