gta.createPickup: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{ScriptItem
{{ScriptItem2
|endpoint = shared
|name = gta.createPickup
|side = shared
|type = function
|type = function
|name = gta.createPickup
|games = iii vc sa iv
|parameters = int model, [ Vec3 position = Vec3(0.0,0.0,0.0), int pickupType = 2 ]
|desc = add a pickup, use the [[addToWorld|addToWorld]] function afterwards to add the pickup to the players games
|parameter1 = int model The pickup model ID.
|arg1 = int model The pickup model ID.
|parameter2 = Vec3 position optional Vec3(0.0,0.0,0.0) The position for the pickup.
|arg2 = [Vec3 position = Vec3(0.0,0.0,0.0)] The position for the pickup.
|parameter3 = int pickupType optional 0 The pickup type.
|arg3 = [int pickupType = 2] The pickup type.
|return1 = Pickup The pickup handle.
|return = Pickup The pickup handle.
|returnFail1 = null n/a
|freturn = null n/a
|usage = add a pickup, use the [[addToWorld|addToWorld]] function afterwards to add the pickup to the players games
 
|returnInfo = a handle to the pickup
|note = Please note that pickup type 0 is invalid.
|notes = Please note that pickup type 0 is invalid.
* List with pickup types can be found [https://gtamods.com/wiki/0213#Pickup_types here] (only for GTA3, GTA:VC and GTA:SA)
* List with pickup models id can be found here: [[Resources/GTA3/Pickups|GTA3]], [[Resources/GTAVC/Pickups|GTA:VC]], [[Resources/GTASA/Pickups|GTA:SA]]
 
|exampleJS = const MODEL_ID = 431 // Craig Package Model in Vice City
const PICKUP_TYPE = 6 // PICKUP_COLLECTABLE1 in Vice City
 
addEventHandler("OnResourceStart",  function(event, resource) {
    gta.createPickup(MODEL_ID, Vec3(0.0,0.0,0.0), PICKUP_TYPE) //Create a pickup in cords X: 0.0, Y: 0.0, Z: 0.0
 
});
}}
}}

Latest revision as of 05:45, 14 January 2024

Function Server and Client icon-iii.png icon-vc.png icon-sa.png icon-iv.png Online and Offline

Available since Server 1.0.0, Client 1.0.0

Pickup gta.createPickup(int model, [ Vec3 position = Vec3(0.0,0.0,0.0) ], [ int pickupType = 2 ])

The gta.createPickup function is used to add a pickup, use the addToWorld function afterwards to add the pickup to the players games.

Parameters

1) int model The pickup model ID.
2) Vec3 position Optional, defaults to Vec3(0.0,0.0,0.0). The position for the pickup.
3) int pickupType Optional, defaults to 2. The pickup type.

Return

Pickup The pickup handle.

Notes

  • Please note that pickup type 0 is invalid.
  • List with pickup types can be found here (only for GTA3, GTA:VC and GTA:SA)
  • List with pickup models id can be found here: GTA3, GTA:VC, GTA:SA.

Examples

Example 1 - JavaScript:

const MODEL_ID = 431 // Craig Package Model in Vice City
const PICKUP_TYPE = 6 // PICKUP_COLLECTABLE1 in Vice City

addEventHandler("OnResourceStart", function(event, resource) {
gta.createPickup(MODEL_ID, Vec3(0.0,0.0,0.0), PICKUP_TYPE) //Create a pickup in cords X: 0.0, Y: 0.0, Z: 0.0

});

Compatibility

There isn't any compatibility information for this function.

Related

Server Related

icon-iii.png icon-vc.png icon-sa.png icon-iv.png getPickupCount
icon-iii.png icon-vc.png icon-sa.png icon-iv.png getPickups
icon-iii.png icon-vc.png icon-sa.png icon-iv.png gta.createPickup


Client Related

icon-iii.png icon-vc.png icon-sa.png getPickupCount
icon-iii.png icon-vc.png icon-sa.png getPickups
icon-vc.png getWeaponPickupPrice
icon-iii.png icon-vc.png icon-sa.png gta.createPickup
icon-iii.png gta.enableHelpPickup
icon-iii.png gta.removeHelpPickup
icon-iii.png gta.removeHelpPickups
icon-iii.png icon-vc.png icon-sa.png setWeaponPickupPrice

icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.children
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.clearExistsFor
icon-iii.png icon-vc.png icon-sa.png pickup.collected
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.dimension
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.existsFor
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.getData
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.getRotation
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.id
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.isCreatedFor
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.isLocal
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.isOwner
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.isSyncer
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.isType
icon-iii.png icon-vc.png icon-sa.png pickup.modelIndex
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.name
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.netFlags
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.parent
icon-iii.png icon-vc.png icon-sa.png pickup.pickupType
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.position
icon-iii.png icon-vc.png icon-sa.png pickup.quantity
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.removeAllData
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.removeData
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.resource
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.rotation
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.setData
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.setExistsFor
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.setRotation
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.setSyncer
icon-iii.png icon-vc.png icon-sa.png pickup.spawnTime
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.streamInDistance
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.streamOutDistance
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.syncer
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.syncerId
icon-iii.png icon-vc.png icon-sa.png icon-iv.png pickup.type