06.05.2018, 12:32
how i can use onplayeprickupickup or onplayerpickupdynamicpickup for an object
#include <a_samp>
#include <streamer>
#define MAX_OBJECT_PICK 100
static ObjectPickup[MAX_OBJECT_PICK] = {-1, ...}; //array to store objects
static Area[MAX_OBJECT_PICK]; //array to store areas
public OnFilterScriptInit()
{
ObjectPickup[0] = CreateDynamicObject(model, Float:x, Float:y, Float:z, Float:RX, Float:RY, Float:RZ); //creating object
CreateDynamicSphere(Float:x, Float:y, Float:z, Float:size); //creating object
return 1;
}
public OnFilterScriptExit() //destroy objects on fs exit
{
for(new i = 0; i < MAX_OBJECT_PICK; i++) // loop
{
if(ObjectPickup[i] == -1) continue; //invalid object skip
DestroyDynamicObject(ObjectPickup[i]); //destroy object
DestroyDynamicArea(Area[i]); //destroy area
}
return 1;
}
public OnPlayerEnterDynamicArea(playerid, areaid)
{
if(areaid == Area[0]) //if area 0
{
//code for first object pickup
}
return 1;
}