createPickup | Multi Theft Auto: Wiki Skip to content

createPickup

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

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.

Syntax

createPickup ( )

Code Examples

server

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 )
end
addEventHandler ( "onPlayerWasted", root, createDeathPickup ) --add an event handler for onPlayerWasted