I am making a game using lite-C (exactly same syntax as C). and I cannot make this loop work.
It gives me an error at this line at compilation.
for(int i = 0; i < (cantenemigu * 3); i += 3)
I have an array with the information of where to create the enemies.
the array contains the x,y,z coordinates.
cantenemigu is the amount of enemies that there are in the array.
With this loop I would get the information of each enemy and create it.
[EDIT] The answers didn't work. I added the ; acsidently while writing the post.
Maybe the problem is somewhere else;
Here is the hole part.
int cantenemigu = 3;
var posenemigu[] = {-900, 550, -10, -1100, 1600, -10, 70, 1680, 20};
void load_enemigunan()
{
for(int i = 0; i < (cantenemigu * 3); i += 3)
{
ent_create("targetr.mdl",vector(posenemigu[i],
posenemigu[i + 1],
posenemigu[i + 2]),NULL);
}
}
This is the code if I don't add the <br>
I solved it.
this worked.
int i
for(i = 0; i < 3*cantenemigu; i += 3)
{
ent_create("targetr.mdl",vector(posenemigu[i],
posenemigu[i + 1],
posenemigu[i + 2]),NULL);
}
In C# it doesn't have be declared before. I assumed it was also so in C. (or maybe it's a bug in the compiler).