13.11.2010, 08:14
(
Последний раз редактировалось Typhome; 13.11.2010 в 18:54.
)
#define CARS_TO_LOAD 4
public LoadCars()
{
for( new i; i < CARS_TO_LOAD; i++ )
{
LoadCar(i);
}
return 1;
}
public LoadCar(ID) // mySQL
{
MySQLCheckConnection();
new queryCommand[256];
new Data[1024];
new Field[256];
format(queryCommand, sizeof(queryCommand), "SELECT * FROM cars WHERE ID = '%i'", ID);
mysql_query(queryCommand);
new idx = 1;
print("passed 0");
print("passed 1");
if(idx < sizeof(CarInfo))
{
print("passed algus");
if(mysql_fetch_row_format(Data,"|"))
{
print("passed 2");
printf("Loading Vehicle Data id %d",idx);
mysql_fetch_field_row(Field,"Model"); CarInfo[idx][cModel] = strval(Field);
mysql_fetch_field_row(Field,"Locationx"); CarInfo[idx][cLocationx] = strval(Field);
mysql_fetch_field_row(Field,"Locationy"); CarInfo[idx][cLocationy] = strval(Field);
mysql_fetch_field_row(Field,"Locationz"); CarInfo[idx][cLocationz] = strval(Field);
mysql_fetch_field_row(Field,"Angle"); CarInfo[idx][cAngle] = strval(Field);
mysql_fetch_field_row(Field,"ColorOne"); CarInfo[idx][cColorOne] = strval(Field);
mysql_fetch_field_row(Field,"ColorTwo"); CarInfo[idx][cColorTwo] = strval(Field);
mysql_fetch_field_row(Field,"Owner"); CarInfo[idx][cOwner] = strval(Field);
mysql_fetch_field_row(Field,"Description"); CarInfo[idx][cDescription] = strval(Field);
mysql_fetch_field_row(Field,"Value"); CarInfo[idx][cValue] = strval(Field);
mysql_fetch_field_row(Field,"Owned"); CarInfo[idx][cOwned] = strval(Field);
mysql_fetch_field_row(Field,"Paintjob"); CarInfo[idx][cPaintjob] = strval(Field);
mysql_fetch_field_row(Field,"mod1"); CarInfo[idx][cmod1] = strval(Field);
mysql_fetch_field_row(Field,"mod2"); CarInfo[idx][cmod2] = strval(Field);
mysql_fetch_field_row(Field,"mod3"); CarInfo[idx][cmod3] = strval(Field);
mysql_fetch_field_row(Field,"mod4"); CarInfo[idx][cmod4] = strval(Field);
mysql_fetch_field_row(Field,"mod5"); CarInfo[idx][cmod5] = strval(Field);
mysql_fetch_field_row(Field,"mod6"); CarInfo[idx][cmod6] = strval(Field);
mysql_fetch_field_row(Field,"mod7"); CarInfo[idx][cmod7] = strval(Field);
mysql_fetch_field_row(Field,"mod8"); CarInfo[idx][cmod8] = strval(Field);
mysql_fetch_field_row(Field,"mod9"); CarInfo[idx][cmod9] = strval(Field);
mysql_fetch_field_row(Field,"mod10"); CarInfo[idx][cmod10] = strval(Field);
mysql_fetch_field_row(Field,"mod11"); CarInfo[idx][cmod11] = strval(Field);
mysql_fetch_field_row(Field,"mod12"); CarInfo[idx][cmod12] = strval(Field);
mysql_fetch_field_row(Field,"mod13"); CarInfo[idx][cmod13] = strval(Field);
mysql_fetch_field_row(Field,"mod14"); CarInfo[idx][cmod14] = strval(Field);
mysql_fetch_field_row(Field,"mod15"); CarInfo[idx][cmod15] = strval(Field);
mysql_fetch_field_row(Field,"mod16"); CarInfo[idx][cmod16] = strval(Field);
mysql_fetch_field_row(Field,"mod17"); CarInfo[idx][cmod17] = strval(Field);
print("passed 3");
idx++;
print("passed 5");
AddStaticVehicleEx(CarInfo[idx][cModel],CarInfo[idx][cLocationx],CarInfo[idx][cLocationy],CarInfo[idx][cLocationz]+1.0,CarInfo[idx][cAngle],CarInfo[idx][cColorOne],CarInfo[idx][cColorTwo],60000);
print("passed 6");
if(CarInfo[idx][cmod1]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod1]); }
if(CarInfo[idx][cmod2]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod2]); }
if(CarInfo[idx][cmod3]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod3]); }
if(CarInfo[idx][cmod4]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod4]); }
if(CarInfo[idx][cmod5]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod5]); }
if(CarInfo[idx][cmod6]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod6]); }
if(CarInfo[idx][cmod7]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod7]); }
if(CarInfo[idx][cmod8]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod8]); }
if(CarInfo[idx][cmod9]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod9]); }
if(CarInfo[idx][cmod10]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod10]); }
if(CarInfo[idx][cmod11]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod11]); }
if(CarInfo[idx][cmod12]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod12]); }
if(CarInfo[idx][cmod13]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod13]); }
if(CarInfo[idx][cmod14]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod14]); }
if(CarInfo[idx][cmod15]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod15]); }
if(CarInfo[idx][cmod16]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod16]); }
if(CarInfo[idx][cmod17]!=-1) { AddVehicleComponent(idx,CarInfo[idx][cmod17]); }
if(CarInfo[idx][cPaintjob]!=-1) { ChangeVehiclePaintjob(idx,CarInfo[idx][cPaintjob]); }
print("passed 7");
}
print("passed l6pp");
}
print("passed 8");
return 1;
}
new idx = ID;
#define idx ID