CreatePickup

From GT-MP
Jump to: navigation, search
CreatePickup
Server-Side Function
Utilities-terminal.png Server-Side Csharp.png C#

Creates a pickup. See Pickup list.

Dialog-warning.png

Note: If shared API was used when creating, then the created entities are not deleted on ResourceStop


Icon-info.png
This method is asynchronous. There is no guarantee the entity will be known to the client when working with it after creation (e.g. setting properties). Use waitForSynchronization() to make sure it's known.

waitForSynchronization() does not guarantee that the entity is streamed in on the client, it just means that the entity is known (and can be updated serverside). If you need to work with it on clientside you will need to check if the entity is streamed in (e.g. by hooking to the onEntityStreamIn event). Entities that are not streamed in can not be accessed using the clientside API. (Version 0.1.7)

Syntax

API.createPickup(PickupHash pickupHash, Vector3 pos, Vector3 rot, int amount, uint respawnTime, int dimension = 0);
API.createPickup(int model, Vector3 pos, Vector3 rot, bool vehicle, uint respawnTime, int dimension = 0);

Required Arguments

- Overload 1:

  • pickupHash: parameter input should be in NetHandle type.
  • pos: parameter input should be in Vector3 type.
  • rot: parameter input should be in Vector3 type.
  • amount: parameter input should be in int type.
  • respawnTime: parameter input should be in uint type.

- Overload 2:

  • model: parameter input should be in int type.
  • pos: parameter input should be in Vector3 type.
  • rot: parameter input should be in Vector3 type.
  • vehicle: parameter input should be in bool type.
  • respawnTime: parameter input should be in uint type.

Optional Arguments:

  • dimension: parameter input should be in int type, Default value = 0.

NOTE: This function returns data in Pickup type.

Usage example(s)

   API.createPickup(pickupHash, pos, rot, amount, respawnTime);
   Pickup myPickup = API.createPickup(model, pos, rot, vehicle, respawnTime);


References