17.02.2011, 18:30
I'm using mysql as my vehicle database and I want to spawn all vehicles in it and I actually also know how it works...
but now I have the problem to read from the different vehicle rows...
I've got this:
however it ofc always gets the information of the first row and spawns it 4 times (currently 4 vehicles in the db)...
so how can I differ between the rows?
but now I have the problem to read from the different vehicle rows...
I've got this:
pawn Код:
new query[50], tmp[256];
format(query, sizeof(query), "SELECT * FROM `Vehicles`");
mysql_query(query);
mysql_store_result();
for(new v=0; v<mysql_num_rows(); v++)
{
mysql_fetch_field("model", tmp);
VehicleData[v][model] = strval(tmp);
mysql_fetch_field("xpos", tmp);
VehicleData[v][xpos] = floatstr(tmp);
mysql_fetch_field("ypos", tmp);
VehicleData[v][ypos] = floatstr(tmp);
mysql_fetch_field("zpos", tmp);
VehicleData[v][zpos] = floatstr(tmp);
mysql_fetch_field("apos", tmp);
VehicleData[v][apos] = floatstr(tmp);
mysql_fetch_field("color1", tmp);
VehicleData[v][c1] = strval(tmp);
mysql_fetch_field("color2", tmp);
VehicleData[v][c2] = strval(tmp);
mysql_fetch_field("interior", tmp);
VehicleData[v][interior] = strval(tmp);
CreateVehicle(VehicleData[v][model], VehicleData[v][xpos], VehicleData[v][ypos], VehicleData[v][zpos], VehicleData[v][apos], VehicleData[v][c1], VehicleData[v][c2], 300);
LinkVehicleToInterior(v, VehicleData[v][interior]);
if(!strcmp(VehicleData[v][plate], "none", true))
{
}else{
SetVehicleNumberPlate(v, VehicleData[v][plate]);
}
}
mysql_free_result();
so how can I differ between the rows?