SA-MP Forums Archive
How to destroy pickups in an array - 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: How to destroy pickups in an array (/showthread.php?tid=451546)



How to destroy pickups in an array - Spikmun - 17.07.2013

OnPlayerDeath I am creating pickups like so

pawn Код:
new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    pDeathInfo[counter][pickupID] = CreatePickup(1254, 1, X, Y, Z, -1);
    pDeathInfo[counter][playerID] = playerid;
    pDeathInfo[counter][playerTeam] = GetPlayerTeam(playerid);
    pDeathInfo[counter][killerWeapon] = GetPlayerWeapon(killerid);
    counter++;
I assumed I could delete all of the pickups by doing

pawn Код:
for(new j = 0; j < MAX_PICKUPS; j++)
    {
        DestroyPickup(pDeathInfo[j][pickupID]);
    }
But this doesn't seem to work. What am I doing wrong? Any help will be appreciated.


Re: How to destroy pickups in an array - Misiur - 17.07.2013

You assumed right, this code should work. Where did you place it? You might consider using iterators (y_iterate/foreach) though.