OnPlayerPickup
The player picked a pickup up - return false to take it back.
The player’s client already holds the item when this runs. Return false and the item is taken from them and the pickup
stays in the world for everyone. Otherwise the pickup is gone for everyone and the item is the player’s - the audit counts
it as explained.
Syntax
Section titled “Syntax”function OnPlayerPickup(pid, id) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the player |
id |
number | the pickup entity (GetEntityTemplate is its class GUID) |
Returns
Section titled “Returns”false refuses the pickup; anything else lets them keep it
Example
Section titled “Example”function OnPlayerPickup(pid, id) if GetEntityData(id, "owner") and GetEntityData(id, "owner") ~= pid then SendClientMessage(pid, COLOUR_RED, "That is not yours.") return false end return trueendSee also
Section titled “See also”OnPlayerDrop · CreatePickup · GetEntityTemplate · the Items and inventory group of the index
