createPickup
Client-side
Server-side
Shared
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function creates a pickup element, which is placed in the GTA world and can be picked up to retrieve a health, armour or a weapon.
OOP Syntax Help! I don't understand this!
Syntax
pickup createPickup ( float x, float y, float z, int theType, int amount/weapon/model, [ int respawnTime = 30000, int ammo = 50 ] )Required Arguments
- x: A floating point number representing the X coordinate on the map.
- y: A floating point number representing the Y coordinate on the map.
- z: A floating point number representing the Z coordinate on the map.
- theType: This is an integer representing the type of pickup, representing the following types: 0 : Health Pickup 1 : Armour Pickup 2 : Weapon Pickup 3 : Custom Pickup
- amount/weapon/model: MISSING_PARAM_DESC
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- respawnTime (default: 30000): How long before the pickup respawns in milliseconds ( This parameter is ignored on the client! )
- ammo (default: 50): An integer representing the amount of ammo a pickup contains. This is only valid when the pickup type is a weapon pickup.
Returns
- pickup: value
Returns pickup element if the pickup was created succesfully, otherwise returns false .
Code Examples
shared
This example creates a pickup after a player dies so that he drops his weapon.
function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z currentweapon = getPlayerWeapon ( source ) --get the current weapon of the dead person createPickup ( x, y, z, 2, currentweapon, 10000, totalammo )endaddEventHandler ( "onPlayerWasted", root, createDeathPickup ) --add an event handler for onPlayerWasted