SA-MP Forums Archive
remove some objects - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: remove some objects (/showthread.php?tid=607119)



remove some objects - Problems - 14.05.2016

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;
                                }



Re: remove some objects - Mic_H - 15.05.2016

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.