29.09.2011, 20:29
Hi guys, I am doing a vehicle system and I've found a problem.
When the foreach loop starts it only does executes once and then stops, but I need it to foreach 50 times (MAX_VEH).
My question is: why it stops after the first execution?
Here's the code:
When the foreach loop starts it only does executes once and then stops, but I need it to foreach 50 times (MAX_VEH).
My question is: why it stops after the first execution?
Here's the code:
pawn Code:
for(new i = 1; i != MAX_VEH; i++)
{
Iter_Add(Vehicles, i);
}
foreach(Vehicles, v)
{
format(qStr, sizeof(qStr), "SELECT * FROM Veicoli WHERE ID = %d", v);
REZ = db_query(vDatabase, qStr);
if(db_num_rows(REZ) == 0)
{
Iter_Remove(Vehicles, v);
printf("[WARNING]: Iter_Remove: %d", v);
db_free_result(REZ);
continue;
}
// Rest of the code...
}