Skip to content

OnPlayerTakeWorldItem

A player’s game took a loose item the level placed on a table or a shelf - return false to take it back.

The item slot key held one item of class class (the GUID; GetItemName names it). Their game already put it in their inventory; return false and the server takes it out of their game at once - in every [audit] mode - the item goes back where it lay in their world, and the slot keeps its item for everyone else. Otherwise that item is gone for everyone and the level’s own item comes back where it lay after the restock period (or when the mode puts it back - ResetWorldItem).

The server checks the take against the level’s data first, and a take that fails is taken back without asking the mode: an item of a slot the level’s tables list must be that slot’s item, taken within about eight metres of its place, not at a dice table, and from a slot not already taken (the leftover copy of a taken slot is tolerated once for each player and slot, for ordinary items only). key is empty for an item the tables list no slot of that class for near where the player stood - a loose item, and every take when the server has no tables export. Such an item is accepted only if it is an ordinary one the game’s tables know, within a limit a minute, never of a guarded category ([audit] guarded_categories), and ammunition only up to what the player shot themselves.

function OnPlayerTakeWorldItem(pid, key, class)
-- ...
end
Parameter Type
pid number the player
key string the item slot’s level name
class string the item class GUID

false refuses the take; anything else accepts it

function OnPlayerTakeWorldItem(pid, key, class)
if GetItemName(class) == "Groschen" and not IsPlayerAdmin(pid) then return false end -- the coins on the tables stay
end

GetWorldItem · GetTakenWorldItems · ResetWorldItem · the Doors and containers group of the index