- Documentation
- Shared functions
- createPickup
Function
createPickup
Creates a pickup: a spinning item to collect - a health pack, body armour, a weapon or any model (e.g. a building entrance icon). A player collects it by walking into it; the server then fires onPickupHit (cancelEvent() there stops the collection), and the pickup hides for respawnInterval and comes back. The meaning of amount depends on the type: health or armour to add, a weapon ID, or a model ID.
Syntax
pickup createPickup(float x, float y, float z, int theType [, int amount = 0, int respawnInterval = 30000, int ammo = 0])Arguments
xfloat- X position.
yfloat- Y position.
zfloat- Z position.
theTypeint- 0 = health, 1 = armour, 2 = weapon, 3 = custom model.
amountint, optional = 0- Type 0/1: how many points to add; type 2: weapon ID; type 3: model ID (e.g. 1239 = "i" icon, 1273 = house).
respawnIntervalint, optional = 30000- Respawn time after pickup in ms.
ammoint, optional = 0- Type 2: amount of ammo.
Returns
The new pickup, or false with bad arguments.
Example
local health = createPickup(2495, -1660, 13.5, 0, 100, 60000)
local deagle = createPickup(2500, -1660, 13.5, 2, 24, 30000, 50)
local entrance = createPickup(2510, -1660, 13.5, 3, 1239, 0)
addEventHandler("onPickupHit", entrance, function(player)
outputChatBox("Wpisz /wejdz, aby wejsc do budynku", player)
cancelEvent()
end)
See also
setPickupTypeChanges an existing pickup's type and contents without recreating it.amountandammomean the same as increatePickup.getPickupTypeReturns the pickup type: 0 health, 1 armour, 2 weapon, 3 custom model.usePickupCollects a pickup manually, as if a player walked into it: gives the contents, firesonPickupUseand hides the pickup for its respawn time. Without a player the pickup is only hidden.onPickupHitA player walked into a pickup. You can block the pickup.