This function will send a chat message to specific player.
Sending a message triggers client side event onPlayerMessage with playerid set as -1.
Original: sendMessageToPlayer
Declaration
async def sendMessageToPlayer(playerid : int, r : int, g : int, b : int, text : str)
Parameters
int playerid: 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 | async def sendMessageToPlayer(playerid : int, r : int, g : int, b : int, text : str):
"""
This function will send a chat message to specific player.
Sending a message triggers client side event [onPlayerMessage](../../defaultEvents/player/onPlayerMessage.md) with playerid set as `-1`.
Original: [sendMessageToPlayer](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/chat/sendMessageToPlayer/)
## Declaration
```python
async def sendMessageToPlayer(playerid : int, r : int, g : int, b : int, text : str)
```
## Parameters
* `int` **playerid**: 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
|