[HELP] Problem with "for"
#1

Hi, i have got a problem with a for, the for loads the car system. The for(i have been trying with "while" but no works so far). The for is this i think is good
Код:
forward CargarSistemaVeh();
public  CargarSistemaVeh()
{

	for (new c=1; c<=MAX_VEHICLES;)
//      new c;
//	while (c != MAX_VEHICLES) Doesnґt work with while
	{
			CargarCoche©;
			//print("Cargando Coche");
			//printf("ID: %d Cargado        |", c);
			c++;
	}
	printf("Vehiculos Cargados");//
}
This works very well i think, but the problem is in "CargarCoche©" fuction when in the DataBase skips a id, for example when you delete a car. When this happens and "CargarCoche" load a invalid id, the "for" of CargarSistemaVeh() ends and end all Ongamemodeinit and Doesnґt load next cars
Код:
forward CargarCoche(carid);
public  CargarCoche(carid)
{
		new sql[100];
		new f[44][44];
		new row[256];
	    format(sql, sizeof(sql), "SELECT * FROM Vehiculos WHERE IDVEH=%d", carid);
	    if(samp_mysql_query(sql))// la consulta devuelve 1 carga el coche
	    {
			samp_mysql_query(sql);// tambien he probado sin repetir esto, osea dejando solo la del if
			samp_mysql_store_result();

				samp_mysql_fetch_row(row);
				split(row,f,'|');
				//here loads the vehicle well and loads data of vehicle
	   }
	  /* else{
//query return 0  Doesnґt work
	   }*/
}
Sorry if my post is confusing.
Reply


Messages In This Thread
[HELP] Problem with "for" - by mark.18 - 27.12.2010, 11:53

Forum Jump:


Users browsing this thread: 1 Guest(s)