SA-MP Forums Archive
Variable [index] - 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: Variable [index] (/showthread.php?tid=309468)



Variable [index] - lamarr007 - 07.01.2012

Hi, i have this variables :
pawn Код:
new barrel[14];
barrel[0] = CreateDynamicObject(1225, -1406.53, 986.81, 1023.33,   0.00, 0.00, 0.00);
....
barrel[13] = CreateDynamicObject(1225, -1377.71, 990.16, 1023.29,   0.00, 0.00, 0.00);
And, how i can do simply this like :
pawn Код:
DestroyObject(barrel[index]);
barrel[index] = CreateObject()



Re: Variable [index] - Norck - 07.01.2012

Do you mean loops? If so, then it will be like this:
pawn Код:
for(new index; index < 14; index++)
{
    DestroyObject(barrel[index]);
    barrel[index] = CreateObject(...);
}