22.08.2010, 22:19
Right now i'm using the code below to load cars from mysql , but it takes ages to load ( ~ 1 minute for 100cars)
Is there an faster way of doing this ? like getting the whole row and spliting it ?
I need an exaple please .
pawn Код:
public LoadVehicle(sqlvehicleid)
{
new query[128];
new row[32];
new vid;
new Float:cx, Float:cy, Float:cz, Float:az;
/// VehModel ///
format(query, sizeof(query), "SELECT `Model` FROM `vehicles` WHERE `id` = %d LIMIT 1", sqlvehicleid);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(row);
vid= strval(row);
/// CX ///
format(query, sizeof(query), "SELECT `Cx` FROM `vehicles` WHERE `id` = %d LIMIT 1", sqlvehicleid);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(row);
cx = strval(row);
/// Cy ///
format(query, sizeof(query), "SELECT `Cy` FROM `vehicles` WHERE `id` = %d LIMIT 1", sqlvehicleid);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(row);
cy = strval(row);
/// Cz ///
format(query, sizeof(query), "SELECT `Cz` FROM `vehicles` WHERE `id` = %d LIMIT 1", sqlvehicleid);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(row);
cz = strval(row);
/// Inc ///
format(query, sizeof(query), "SELECT `Inc` FROM `vehicles` WHERE `id` = %d LIMIT 1", sqlvehicleid);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(row);
az = strval(row);
/// PRINTING ALL //
printf("SERVER:AddStaticVehicle(%d,%f,%f,%f,%f,-1,-1)",vid,cx,cy,cz,az);
AddStaticVehicle(vid,cx,cy,cz,az,-1,-1);
totalveh++;
}
I need an exaple please .