OnWorldItemSpawn

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 22:32, 14 August 2026 by QCherry (talk | contribs) (Update Lua event reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

onWorldItemSpawn

Triggered when the server creates a synchronized pickup item in the world.

Availability

This event is available in server-side scripts.

Callback signature

onWorldItemSpawn(objectId, itemKey, quantity, x, y, z, sourcePlayerId)

Parameters

Name Type Description
objectId int The authoritative world-item object ID.
itemKey string The stable item definition key.
quantity int The spawned quantity.
x number Spawn X coordinate in metres.
y number Spawn Y coordinate in metres.
z number Spawn Z coordinate in metres.
sourcePlayerId int The player associated with the spawn request, if any.

Examples

Handle the event:

addEventHandler("onWorldItemSpawn", root, function(objectId, itemKey, quantity, x, y, z, sourcePlayerId)
    outputDebugString("Spawned " .. quantity .. "x " .. itemKey .. " as world item " .. objectId)
end)

Notes

  • Synchronized items are server-owned and are included in late-join state.