Opis: Radio sam cos u mysqlu ali nece da ucita vozila (ima ukupno 3 vozila u bazi)
Kodovi:
stock GetFreeCarID()
{
for(new i=0;i < sizeof(CI);i++)
{
if(CI==0) return i;
}
return 0;
}
forward OnCarsLoad();
public OnCarsLoad()
{
print("debug2");
new num_rows;
cache_get_row_count(num_rows);
if(num_rows == 0) return 1;
for(new i=0;i < num_rows;i++)
{
new id=GetFreeCarID();
print("debug3");
cache_get_value_name_int(i,"model",CI);
cache_get_value_name_int(i,"owner",CI);
cache_get_value_name_int(i,"id",CI);
cache_get_value_name_float(i,"x",CI);
cache_get_value_name_float(i,"y",CI);
cache_get_value_name_float(i,"z",CI);
cache_get_value_name_float(i,"r",CI);
CI = CreateVehicle(CI,CI,CI,CI,CI,-1,-1,-1); printf("Vehicle - %i - Loaded",CI);
print("debug4");
}
return 1;
}
stock LoadCOSCars()
{
new query;
format(query,sizeof(query),"SELECT * FROM cos");
mysql_pquery(MySQL,query,"OnCarsLoad","");
print("Debug1");
return 1;
}
//ONgamemodeinit
LoadCOSCars();