Skip to content

CreatePickup

Puts an item on the ground for everyone to see and anyone to take.

A pickup entity of ENTITY_ITEM: every client in range shows the item lying at the point; whoever takes it gets the item (OnPlayerPickup) and the pickup is gone for everyone. item is any key of the item catalogue. world is the virtual world (nil = the shared one). nil when the key is unknown or the world is full ([world] max_entities). The /item built-in places one in front of an admin.

CreatePickup(item, x, y, z [, yaw, world])
Parameter Type
item string | number the item’s name, id, English name or GUID
x number metres
y number metres
z number metres
yaw number degrees (0 without) (optional)
world number the virtual world; nil = the shared one (optional)

number - the pickup’s entity id; nil when it could not be made

-- a reward on the arena floor
local x, y, z = GetPlayerPos(loser)
local id = CreatePickup("longSwordDuel", x, y, z)
if id then SetEntityData(id, "owner", winner) end

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