I gotthis code to create some plants, how can i save the ID of the plant that is created for a specific player so i can destroy it when the player disconnect
Код:
for(new weed = 0; weed < sizeof(WeedInfo); weed++)
{
new Float:X,Float:Y,Float:Z;
ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
GetPlayerPos(playerid, X, Y, Z);
WeedInfo[weed][wPlantObject] = CreateDynamicObject(3409, X, Y, Z-1.0, 0, 0, 0, 0);
WeedInfo[weed][wX] = X;
WeedInfo[weed][wY] = Y;
WeedInfo[weed][wZ] = Z;
WeedInfo[weed][wSeeds]--;
WeedInfo[weed][wLabel] = Create3DTextLabel("PLANT STATUS: Not ready for picking.",COLOR_SILVER,WeedInfo[weed][wX],WeedInfo[weed][wY],WeedInfo[weed][wZ],10.0,0);
WeedInfo[weed][wLabels]++;
SetTimer("PlantWeedTimer",60000*5,0); // 60 seconds times 5 = 5 minutes.
WeedInfo[playerid][wAbleToPlant] = false;
return 1;
}
Show us the Enum of "WeedInfo". I think you are doing it all wrong with creating it.
WeedInfo[weed][wPlantObject] -> if you do this, it will replace IDs everytime you make new weed. Will end up bad and will end up with shitload of objects.