Skip to content

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.

function OnPlayerPickup(pid, id)
-- ...
end
Parameter Type
pid number the player
id number the pickup entity (GetEntityTemplate is its class GUID)

false refuses the pickup; anything else lets them keep it

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 true
end

OnPlayerDrop · CreatePickup · GetEntityTemplate · the Items and inventory group of the index