From 9470ef992146f0b87da22a3f3b92c6339def7cec Mon Sep 17 00:00:00 2001 From: AURUMVORXX Date: Wed, 6 Nov 2024 11:17:58 +0300 Subject: [PATCH] docs: Added onPlayerDropItem and onPlayerTakeItem events --- docs/defaultEvents/player/onPlayerDropItem.md | 19 ++++++++++++++++ docs/defaultEvents/player/onPlayerTakeItem.md | 22 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 docs/defaultEvents/player/onPlayerDropItem.md create mode 100644 docs/defaultEvents/player/onPlayerTakeItem.md diff --git a/docs/defaultEvents/player/onPlayerDropItem.md b/docs/defaultEvents/player/onPlayerDropItem.md new file mode 100644 index 0000000..1379edf --- /dev/null +++ b/docs/defaultEvents/player/onPlayerDropItem.md @@ -0,0 +1,19 @@ +# `event` onPlayerDropItem +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/) + +## Parameters +* `dict` **kwargs**: + * `int` **playerid**: the id of the player who tries to drop the item on the ground. + * `ItemGround` **itemGround**: the ground item object which represents the dropped item by the player. + +## Usage +```python +import g2o + +@g2o.event('onPlayerDropItem') +def onDropItem(**kwargs): + item = itemm['itemGround'] + print(f'Player {kwargs['playerid']} dropped {item.instance} x{item.amount}') +``` \ No newline at end of file diff --git a/docs/defaultEvents/player/onPlayerTakeItem.md b/docs/defaultEvents/player/onPlayerTakeItem.md new file mode 100644 index 0000000..5204131 --- /dev/null +++ b/docs/defaultEvents/player/onPlayerTakeItem.md @@ -0,0 +1,22 @@ +# `event` onPlayerTakeItem +!!! 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. + +This event is triggered when player takes an item from the ground. + +Original: [onPlayerTakeItem](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-events/player/onPlayerTakeItem/) + +## Parameters +* `dict` **kwargs**: + * `int` **playerid**: the id of the player who tries to take the ground item. + * `ItemGround` **itemGround**: the ground item object which player tried to to take. + +## Usage +```python +import g2o + +@g2o.event('onPlayerTakeItem') +def onTakeItem(**kwargs): + item = itemm['itemGround'] + print(f'Player {kwargs['playerid']} took {item.instance} x{item.amount}') +``` \ No newline at end of file