docs: Added onPlayerDamage event

+ added info boxes about event cancelling
This commit is contained in:
AURUMVORXX
2024-11-06 19:59:08 +03:00
parent 9206d251e6
commit fe0604d79c
8 changed files with 29 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
# `event` onBan
> [!TIP] This event can be cancelled
!!! note
If serial/mac/ip/name indexes doesn't exist, then the parameters has not been specified when ban was added.
If timestamp doesn't exist, then ban was permanent.

View File

@@ -1,4 +1,5 @@
# `event` onUnban
> [!TIP] This event can be cancelled
!!! note
If serial/mac/ip/name indexes doesn't exist, then the parameters has not been specified when ban was added.
If timestamp doesn't exist, then ban was permanent.

View File

@@ -1,4 +1,5 @@
# `event` onPlayerChangeWorld
> [!TIP] This event can be cancelled
This event is triggered when player tries to change his currently played world (ZEN).
Original: [onPlayerChangeWorld](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-events/player/onPlayerChangeWorld/)

View File

@@ -0,0 +1,21 @@
# `event` onPlayerDamage
> [!TIP] This event can be cancelled
This event is triggered when player receives damage.
Original: [onPlayerDamage](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-events/player/onPlayerDamage/)
## Parameters
* `dict` **kwargs**:
* `int` **playerid**: the id of the player who died.
* `int` **killerid**: the id of the killer. If killerid is set to `-1`, it means that there was no killer. In this particular case damage source can be fall from a tall object or scripts.
* `DamageDescription` **description**: a structure containing damage information. For more information see [DamageDescription](../../classes/game/DamageDescription.md)
## Usage
```python
import g2o
@g2o.event('onPlayerDamage')
def onDamage(**kwargs):
desc = kwargs['description']
print(f'Ouch! Player {kwargs['playerid']} just received {desc.damage} damage.')
```

View File

@@ -1,4 +1,5 @@
# `event` onPlayerDropItem
> [!TIP] This event can be cancelled
This event is triggered when player drops an item from his inventory to the ground.
Original: [onPlayerDropItem](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-events/player/onPlayerDropItem/)

View File

@@ -1,4 +1,5 @@
# `event` onPlayerSpellCast
> [!TIP] This event can be cancelled
!!! note
Right now transformation and summon spells are not supported, despite this event will be triggered for them. Cancelling this event willl prevent this action to be synced to other players.

View File

@@ -1,4 +1,5 @@
# `event` onPlayerTakeItem
# `event` onPlayerTakeItem
> [!TIP] This event can be cancelled
!!! note
Even if this event is triggered it doesn't mean, that player will get item to his inventory. It only means, that the player tried to get the item from the ground. Server is the last decide if the item can be taken from the ground. Canceling this event will prevent the item to be taken from the ground.