docs: Added onPlayerDamage event
+ added info boxes about event cancelling
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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/)
|
||||
|
||||
21
docs/defaultEvents/player/onPlayerDamage.md
Normal file
21
docs/defaultEvents/player/onPlayerDamage.md
Normal 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.')
|
||||
```
|
||||
@@ -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/)
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ nav:
|
||||
- onPlayerChangeWeaponMode: defaultEvents/player/onPlayerChangeWeaponMode.md
|
||||
- onPlayerChangeWorld: defaultEvents/player/onPlayerChangeWorld.md
|
||||
- onPlayerCommand: defaultEvents/player/onPlayerCommand.md
|
||||
- onPlayerDamage: defaultEvents/player/onPlayerDamage.md
|
||||
- onPlayerDead: defaultEvents/player/onPlayerDead.md
|
||||
- onPlayerDisconnect: defaultEvents/player/onPlayerDisconnect.md
|
||||
- onPlayerDropItem: defaultEvents/player/onPlayerDropItem.md
|
||||
|
||||
Reference in New Issue
Block a user