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 back - as soon as the player’s inventory shows it, a second or so later - and the slot keeps its item for everyone else. Otherwise the slot is empty for everyone and the server puts a pickup back where the item stood after the restock period.

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 · RespawnWorldItem · the Doors and containers group of the index