CreatePickup
Description:
Function CreatePickup does exactly the same as AddStaticPickup, except it returns a pickup ID which can be used to destroy it afterwards and be tracked using OnPlayerPickUpPickup.
Known Bug(s): Pickups that have a X or Y lower than -4096.0 or bigger than 4096.0 won't show up and won't trigger OnPlayerPickUpPickup either. |
|
Parameters:
(model, type, Float:X, Float:Y, Float:Z, virtualworld)
int | model | The model of the pickup. |
int | type | The pickup spawn type. |
float | X | The X coordinate to create the pickup at. |
float | Y | The Y coordinate to create the pickup at. |
float | Z | The Z coordinate to create the pickup at. |
int | virtualworld | The virtual world ID of the pickup. Use -1 to make the pickup show in all worlds. |
Return Values:
The ID of the created pickup, -1 on failure (pickup max limit).
Examples:
new pickup; // Create a variable to store the pickup ID in public OnGameModeInit() { pickup = CreatePickup(1242, 2, 1503.3359, 1432.3585, 10.1191, -1); // Create an armour pickup and store the ID in 'pickup' return 1; } // Later.. DestroyPickup(pickup); // Example of using the pickup ID pickup = 0; // pickup variable needs to be reset to avoid future conflicts
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- AddStaticPickup: Add a static pickup.
- DestroyPickup: Destroy a pickup.
Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.
- OnPlayerPickUpPickup: Called when a player picks up a pickup.