Skip to content

function sendPlayerMessageToPlayer

This function will send a chat message from one player to another player.
Sending a message triggers client side event onPlayerMessage with playerid set as senderid.
Original: sendPlayerMessageToPlayer

Declaration

async def sendPlayerMessageToPlayer(senderid : int, receiverid : int, r : int, g : int, b : int, text : str)

Parameters

  • int senderid: the id of the player which will send a message.
  • int receiverid: the id of the player which will receive a message.
  • int r: the red color component in RGB model.
  • int g: the green color component in RGB model.
  • int b: the blue color component in RGB model.
  • str text: that will be send.
Source code in src/pyg2o/functions/chat.py
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
async def sendPlayerMessageToPlayer(senderid : int, receiverid : int, r : int, g : int, b : int, text : str):
    """
    This function will send a chat message from one player to another player.
    Sending a message triggers client side event [onPlayerMessage](../../defaultEvents/player/onPlayerMessage.md) with playerid set as **senderid**.
    Original: [sendPlayerMessageToPlayer](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/chat/sendPlayerMessageToPlayer/)

    ## Declaration
    ```python
    async def sendPlayerMessageToPlayer(senderid : int, receiverid : int, r : int, g : int, b : int, text : str)
    ```

    ## Parameters
    * `int` **senderid**: the id of the player which will send a message.
    * `int` **receiverid**: the id of the player which will receive a message.
    * `int` **r**: the red color component in RGB model.
    * `int` **g**: the green color component in RGB model.
    * `int` **b**: the blue color component in RGB model.
    * `str` **text**: that will be send.
    """
    data = f'return {get_call_repr()}'

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