How to destroy pickups in an array
#1

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.
Reply
#2

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


Forum Jump:


Users browsing this thread: 1 Guest(s)