OnWorldItemPickup: Difference between revisions
Jump to navigation
Jump to search
Document upcoming 0.1.9 custom native keys, shared doors, server Lua callbacks and persistence; not a release |
Release 0.1.9 / BUILD264 / Protocol42: availability and download setup; preserve experimental limits |
||
| Line 48: | Line 48: | ||
<!-- customkeys019:start --> | <!-- customkeys019:start --> | ||
'''Available from 0.1.9 | '''Available from 0.1.9. Use matching updated server and clients.''' | ||
== Custom-key pickup == | == Custom-key pickup == | ||
The existing <code>(objectId, playerId, item, quantity, serverTimeMs)</code> event also reports registered custom keys using their canonical identity. Inventory was already granted by the core; do not give it again. Persist your gamemode inventory as needed. This is a reserved server notification, not remotely triggerable. See [[Custom keys]]. | The existing <code>(objectId, playerId, item, quantity, serverTimeMs)</code> event also reports registered custom keys using their canonical identity. Inventory was already granted by the core; do not give it again. Persist your gamemode inventory as needed. This is a reserved server notification, not remotely triggerable. See [[Custom keys]]. | ||
<!-- customkeys019:end --> | <!-- customkeys019:end --> | ||
Latest revision as of 13:28, 20 October 2026
onWorldItemPickup
IMPROVED FROM UPDATE 0.1.2
This event is available in earlier releases and has corrected or expanded behavior in G1R:MP 0.1.2 and later. The contract below describes the updated behavior.
Triggered after the server accepts a synchronized world-item pickup and applies its authoritative inventory grant.
Availability
This event is available in server-side scripts.
Callback signature
onWorldItemPickup(objectId, playerId, itemKey, quantity, serverTimeMs)
Parameters
| Name | Type | Description |
|---|---|---|
objectId |
int |
The positive server-assigned 64-bit world-item object ID. |
playerId |
int |
The player that picked up the item. |
itemKey |
string |
The stable item definition key. |
quantity |
int |
The complete accepted world-stack quantity granted to the player. |
serverTimeMs |
int |
Server timestamp of the accepted pickup. |
Examples
Handle the event:
addEventHandler("onWorldItemPickup", root, function(objectId, playerId, itemKey, quantity, serverTimeMs)
outputDebugString(getPlayerName(playerId) .. " picked up " .. itemKey)
end)
Notes
- The server has already added
quantityto its authoritative native inventory cache before this observation event. Do not grant the same items again from the handler. - The picked-up tombstone is broadcast reliably and the object is removed from active late-join state before callbacks run. The bundled GothicRP resource then persists the inventory grant asynchronously.
- Rejected, stale, duplicate, out-of-range, or over-capacity pickup attempts do not emit this event.
Available from 0.1.9. Use matching updated server and clients.
Custom-key pickup
The existing (objectId, playerId, item, quantity, serverTimeMs) event also reports registered custom keys using their canonical identity. Inventory was already granted by the core; do not give it again. Persist your gamemode inventory as needed. This is a reserved server notification, not remotely triggerable. See Custom keys.