26.04.2012, 04:02
(
Последний раз редактировалось Jonny5; 26.04.2012 в 05:03.
)
Okay so earlier I imported all my vehicle files into a SQLite db
all thats fine but now when i go to load them in OnGameModeInit()
i never see any vehicles when i spawn.
so it prints to the log every vehicle from the db (1827) in this case.
All that looks good,
but when i log in i don't see any vehicles!
Im pretty much loading the same way I did in the past from my files
just getting my data from the db.
I have tried with just using CreateVehicle() and also AddStaticVehicleEx()
and same results
maybe im missing something here...
thanks.
EDIT:
I figured it out,
was missing 4 FLOAT: tags.
all thats fine but now when i go to load them in OnGameModeInit()
i never see any vehicles when i spawn.
pawn Код:
stock LoadVehiclesFromBD()
{
new DBResult:Result;
new modelid,SpawnX,SpawnY,SpawnZ,SpawnRot,vehicles_loaded,vid;
Result = db_query( Database, "SELECT * FROM `VEHICLES`" );
print("Loading vehicles from: database.... please waite....");
for(new a,r=db_num_rows(Result);a<r;a++)
{
new str[256],str2[32];
db_get_field_assoc(Result,"MODEL",str2,32);
strcat(str,str2);
strcat(str," ");
db_get_field_assoc(Result,"X",str2,32);
strcat(str,str2);
strcat(str," ");
db_get_field_assoc(Result,"Y",str2,32);
strcat(str,str2);
strcat(str," ");
db_get_field_assoc(Result,"Z",str2,32);
strcat(str,str2);
strcat(str," ");
db_get_field_assoc(Result,"R",str2,32);
strcat(str,str2);
if(!sscanf(str, "iffff", modelid,SpawnX,SpawnY,SpawnZ,SpawnRot))
{
//vid = AddStaticVehicleEx(modelid,SpawnX,SpawnY,SpawnZ,SpawnRot,-1,-1,60);
vid = AddStaticVehicle(modelid,SpawnX,SpawnY,SpawnZ,SpawnRot,-1,-1);
LinkVehicleToInterior(vid, 0);
SetVehicleVirtualWorld(vid, 0);
printf("veh (%i) %s",vid,str);
vehicles_loaded++;
}
db_next_row(Result);
}
db_free_result(Result);
printf("Loaded %d vehicles from: database",vehicles_loaded);
return 1;
}
so it prints to the log every vehicle from the db (1827) in this case.
All that looks good,
but when i log in i don't see any vehicles!
Im pretty much loading the same way I did in the past from my files
just getting my data from the db.
I have tried with just using CreateVehicle() and also AddStaticVehicleEx()
and same results
maybe im missing something here...
thanks.
EDIT:
I figured it out,
was missing 4 FLOAT: tags.