How can i get an array to do this... -
Ash. - 30.07.2010
Hi guys and girls
I need an array to create loads of pickups around the map (i have the x, y, z coords) - If i have the array, do i do this:
pawn Код:
CreatePickup(playerid, ModelID, Array[x], Array[y], Array[z]);
The model id will be the same for all, but the Create Pickup command will need to do it for all x.y.z coords.
How do i do this? - Ive done it before but i forgot how i did it lol
Thanks in advance
Ash!
Re: How can i get an array to do this... -
Mauzen - 30.07.2010
Id guess your array with the Coords is multi-dimensional, something like this:
new Float: pickups[][3]
Then you can create your pickups using a for-loop and using the counter as index for your array:
pawn Код:
for(new i = 0; i < sizeof(pickups); i ++) {
CreatePickup(..., pickups[i][0], pickups[i][1], pickups[i][2]); //with 0,1,2 beeing x,y,z
}
Re: How can i get an array to do this... -
Ash. - 30.07.2010
Quote:
Originally Posted by Mauzen
Id guess your array with the Coords is multi-dimensional, something like this:
new Float: pickups[][3]
Then you can create your pickups using a for-loop and using the counter as index for your array:
pawn Код:
for(new i = 0; i < sizeof(pickups); i ++) { CreatePickup(..., pickups[i][0], pickups[i][1], pickups[i][2]); //with 0,1,2 beeing x,y,z }
|
Ahh, i knew it was something, thanks
Another thing, could i enum the array? So instead of 1, 2 and 3 being x, y, z i could actually call them x, y and z.
Like this:
pawn Код:
for(new i = 0; i < sizeof(pickups); i ++) {
CreatePickup(..., pickups[i][x], pickups[i][y], pickups[i][z]);
}
Thanks
Ash
Re: How can i get an array to do this... -
Vince - 30.07.2010
pawn Код:
enum pData
{
x,
y,
z
};
new Pickups[][pData];
Re: How can i get an array to do this... -
Mauzen - 30.07.2010
No problem, and yes, you can use an enum, that should work in the same way.
Re: How can i get an array to do this... -
Ash. - 30.07.2010
Thanks

- Hope i can return a favour
Re: How can i get an array to do this... -
Cameltoe - 30.07.2010
Also needed this! thanks a lot : ))