OnWorldItemDrop
Jump to navigation
Jump to search
onWorldItemDrop
AVAILABLE FROM UPDATE 0.1.2
This event is available in G1R:MP 0.1.2 and later. The contract below includes the compatibility guarantees introduced in that update.
Triggered for public server resources after a player-initiated world-item drop is durably committed and published.
Availability
This event is available in server-side scripts.
Callback signature
onWorldItemDrop(objectId, playerId, itemKey, quantity, serverTimeMs)
Parameters
| Name | Type | Description |
|---|---|---|
objectId |
int |
The positive server-assigned 64-bit ID of the published dropped item. |
playerId |
int |
The player whose inventory supplied the dropped item. |
itemKey |
string |
The stable inventory and world-item definition key. |
quantity |
int |
The committed quantity removed from inventory and published in the world. |
serverTimeMs |
int |
Server timestamp recorded when the accepted drop intent created the quarantined item. |
Examples
Handle the event:
addEventHandler("onWorldItemDrop", root, function(objectId, playerId, itemKey, quantity, serverTimeMs)
outputDebugString("Player " .. playerId .. " dropped " .. quantity .. "x " .. itemKey)
end)
Notes
- The runtime first quarantines the new object and removes the quantity from the authoritative inventory cache. The bundled GothicRP resource persists that change before confirming the transaction.
- Only a successful durable confirmation publishes the item and emits this callback to public resources. A failed or rolled-back drop publishes no public
onWorldItemDropevent and restores the authoritative inventory state when the session is still connected. - The active item is broadcast reliably before public callbacks run and is then included in late-join state. This is an observation event: do not remove the inventory quantity a second time.
- Player-initiated drops emit this event instead of onWorldItemSpawn.