This commit is contained in:
Maxim Khomutov 2023-07-23 00:17:32 +03:00
parent 9253f24421
commit d76262fc43

View File

@ -205,41 +205,94 @@ _`pl = event_data['kwargs']['player']`_
### pl.log -> Logger ### pl.log -> Logger
_Constant_\ _Constant_\
Returns a pre-configured logger Returns a preconfigured logger.
### pl.addr -> str ### pl.addr -> str
_Constant_\ _Constant_\
Returns the IP address of the player Returns the player's IP address.
### pl.pid -> int ### pl.pid -> int
### pl.cid -> int ### pl.cid -> int
_Constant_\ _Constant_\
Returns the client ID _(pid: PlayerId = cid: ClientId)_ Returns the client ID _(pid: PlayerId = cid: ClientId)_.
### pl.key -> str ### pl.key -> str
_Constant_\ _Constant_\
Returns the key passed during authentication Returns the key passed during authorization.
### pl.nick -> str ### pl.nick -> str
_Variable_\ _Variable_\
The nickname passed during authentication from the BeamMP server, can be changed, consequences are untested Nickname passed during authorization from the BeamMP server, can be changed, consequences are not tested.
### pl.roles -> str ### pl.roles -> str
_Variable_\ _Variable_\
The role passed during authentication from the BeamMP server, can be changed (if an incorrect role is set, unexpected things may happen.) Role passed during authorization from the BeamMP server, can be changed (If the wrong role is set, unexpected behavior may occur.)
### pl.guest -> bool ### pl.guest -> bool
_Constant_\ _Constant_\
Returns whether the player is a guest, passed during authentication from the BeamMP server Returns whether the player is a guest, passed during authorization from the BeamMP server.
### pl.identifiers -> dict ### pl.identifiers -> dict
_Constant_\ _Constant_\
Identifiers passed during authentication from the BeamMP server. Identifiers passed during authorization from the BeamMP server.
### pl.ready -> bool ### pl.ready -> bool
_Constant, changed by the core_\ _Constant, changed by the core_\
Returns a bool value, if True -> the player has downloaded all resources, loaded on the map Returns a bool value, if True -> player has downloaded all resources and loaded on the map.
### pl.cars -> dict ### pl.cars -> dict
_Constant, changed by the core_\ _Constant, changed by the core_\
Returns a dictionary of cars like this Returns a dictionary of cars by type:
```python
{
1: {
"packet": car_packet,
"json": car_json,
"json_ok": bool(car_json),
"snowman": snowman,
"over_spawn": (snowman and allow_snowman) or over_spawn,
"pos": {
"pos":[0,0,0],
"rvel":[0,0,0],
"rot":[0,0,0],
"vel":[0,0,0],
"tim":0,
"ping":0
}
},
2: ...
}
```
Where `1` - car_id\
Where `pkt` - Unprocessed packet that came from the client (For very experienced users)\
Where `json` - Processed packet stored as dict\
Where `json_ok` - Whether the core was able to process the packet\
Where `snowman` - Is the car a snowman\
Where `over_spawn` - Is the car spawned over the limit (Allowed through plugins)\
Where `pos` - Car position (Passed through UDP)
### pl.last_position -> dict
_Constant, changed by the core_\
Returns the player's last position
### **async** pl.kick([reason: str = "Kicked!"]) -> None
_`reason: str` -> Kick reason. Parameter is optional, by default: `Kicked!`_\
Kicks the player from the server.
### **async** pl.send_message(message: str, [to_all: bool = True]) -> None
_`message: str` -> Message text, sent without "Server:"_\
_`to_all: bool` -> Should this message be sent to everyone? Parameter is optional, by default: `True`_\
Sends a message to the player or everyone.
### **async** pl.send_event(event_name: str, event_data: Any, [to_all: bool = True]) -> None
_`event_name: str` -> Name of the event that will be called_\
_`event_data: Any` -> Data sent to the event._\
_`to_all: bool` -> Should this message be sent to everyone? Parameter is optional, by default: `True`_\
Sends an event to the client.\
If event_data is a tuple, list, dict, then before sending the core converts it to JSON via json.dumps(event_data)\
Otherwise, the data will be a string without regulation.
### **async** pl.delete_car(self, car_id: int) -> None
_`car_id: int` -> Car ID_\
Deletes the player's car.