Skip to content

OnPlayerDrop

The player dropped an item and the world made a pickup of it.

The player’s own game dropped the item; the server made pickup id of it so everyone sees it lying there and anyone may take it. Nothing to veto - the dropper’s screen already shows it; a mode that wants it gone calls DestroyEntity. A drop the server refuses makes no pickup and this does not run: a dead player’s, one farther than six metres from where the player is, an item class the server cannot read, a flood of drops (more than four seconds’ worth waiting), a drop while the world is full ([world] max_entities), and - under [audit] mode = "enforce" - more than the records explain, or one in the first seconds of a visit. The item then lies on the dropper’s screen alone, and taking it back is no violation. A stack the records explain only in part becomes a pickup of that part.

A player’s pickups are made one per quarter of a second at most: a drop that comes sooner (two items dropped at once) waits its turn, so this can run a moment after the drop itself. A drop its dropper takes back before its turn never becomes a pickup and this does not run; a player who leaves with drops still waiting gets them made at once, before OnPlayerDisconnect.

function OnPlayerDrop(pid, id)
-- ...
end
Parameter Type
pid number the player
id number the new pickup entity

nothing

-- dropped items vanish after two minutes
function OnPlayerDrop(pid, id)
SetTimer(function() DestroyEntity(id) end, 120000)
end

OnPlayerPickup · DestroyEntity · GetEntityTemplate · the Items and inventory group of the index