Hi,
Ich habe ein stock der die Autos lädt. Doch ich habe nur ein Auto gespawnt und es wird auch in die MySQL gespeichert.
Doch beim laden, spawnt er 10 Autos.
#define MAX_CARS 10
stock LoadCars()
{
for(new i = 0; i <MAX_CARS; i++)
{
new query[128],data[128],bedienung[40];
format(bedienung,sizeof(bedienung),"id = '%i'",i);
format(query,sizeof(query),"SELECT * FROM cars WHERE %i", bedienung);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())
{
mysql_fetch_field("owner",data);
strins(Car[i][owner],data,0);
strdel(data,0,100);
mysql_fetch_field("owner",data);
strins(Car[i][owner],data,0);
strdel(data,0,100);
mysql_fetch_field("x",data);
Car[i][x]=floatstr(data);
strdel(data,0,100);
mysql_fetch_field("y",data);
Car[i][y]=floatstr(data);
strdel(data,0,100);
mysql_fetch_field("z",data);
Car[i][z]=floatstr(data);
mysql_fetch_field("c1",data);
Car[i][c1]=strval(data);
strdel(data,0,100);
mysql_fetch_field("c2",data);
Car[i][c2]=strval(data);
strdel(data,0,100);
mysql_fetch_field("plate",data);
strins(Car[i][plate],data,0);
strdel(data,0,100);
mysql_fetch_field("model",data);
Car[i][model]=strval(data);
strdel(data,0,100);
mysql_fetch_field("price",data);
Car[i][price]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod1",data);
Car[i][mod1]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod2",data);
Car[i][mod2]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod3",data);
Car[i][mod3]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod4",data);
Car[i][mod4]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod5",data);
Car[i][mod5]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod6",data);
Car[i][c2]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod7",data);
Car[i][mod7]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod8",data);
Car[i][mod8]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod9",data);
Car[i][mod9]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod10",data);
Car[i][mod10]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod11",data);
Car[i][mod11]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod12",data);
Car[i][mod12]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod13",data);
Car[i][mod13]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod14",data);
Car[i][mod14]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod15",data);
Car[i][mod15]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod16",data);
Car[i][mod16]=strval(data);
strdel(data,0,100);
mysql_fetch_field("mod17",data);
Car[i][mod17]=strval(data);
strdel(data,0,100);
}
mysql_free_result();
printf("%d %f %f %f %f %d %d",Car[i][model], Car[i][x], Car[i][y], Car[i][z], Car[i][r], Car[i][c1], Car[i][c2]);
Car[i][car] = CreateVehicle(Car[i][model], Car[i][x], Car[i][y], Car[i][z], Car[i][r], Car[i][c1], Car[i][c2], -1);
SetVehicleNumberPlate(Car[i][car], Car[i][plate]);
}
return 1;
}
Server Log.
[23:02:56] 411 -2005.861938 151.196578 27.539062 0.000000 0 -1
[23:02:56] 411 -2005.861938 151.196578 27.539062 0.000000 0 -1
[23:02:56] 411 -2005.861938 151.196578 27.539062 0.000000 0 -1
[23:02:56] 411 -2005.861938 151.196578 27.539062 0.000000 0 -1
[23:02:56] 411 -2005.861938 151.196578 27.539062 0.000000 0 -1
[23:02:56] 411 -2005.861938 151.196578 27.539062 0.000000 0 -1
[23:02:56] 411 -2005.861938 151.196578 27.539062 0.000000 0 -1
[23:02:56] 411 -2005.861938 151.196578 27.539062 0.000000 0 -1
[23:02:56] 411 -2005.861938 151.196578 27.539062 0.000000 0 -1
[23:02:56] 411 -2005.861938 151.196578 27.539062 0.000000 0 -1
//E: Habe bemerkt das er das Auto nur am Anfang der Tabelle also das 2 Auto nicht nur das erste.