21.03.2014, 20:21
When i want to load vehicles from database print this in mysql log.Database isn't empty.
This is code.
ANd this ongamemodeinit
Код:
[18:24:40] [DEBUG] Calling callback "LoadCars".. [18:24:40] [DEBUG] cache_get_data - connection: 1 [18:24:40] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
Код:
forward LoadCars();
public LoadCars()
{
new rows, fields;
cache_get_data(rows, fields);
if(rows)
{
new id = rows + 1;
for(new i = 249; i < id; i++)
{
format(szString, sizeof(szString), "SELECT * FROM `Vozila` WHERE `ID` = '%d'", i);
mysql_pquery(connection, szString, "DLCars", "i", i);
}
}
return 1;
}
forward DLCars(v);
public DLCars(v)
{
new rows, fields;
cache_get_data(rows, fields);
if(rows)
{
v = cache_get_row_int(0, 0);
Vozila[v][mKoristen] = cache_get_row_int(0, 1);
Vozila[v][mModel] = cache_get_row_int(0, 2);
Vozila[v][mX] = cache_get_row_float(0, 3);
Vozila[v][mY] = cache_get_row_float(0, 4);
Vozila[v][mZ] = cache_get_row_float(0, 5);
Vozila[v][mA] = cache_get_row_float(0, 6);
Vozila[v][mpBoja] = cache_get_row_int(0, 7);
Vozila[v][mdBoja] = cache_get_row_int(0, 8);
Vozila[v][mZakljucan] = cache_get_row_int(0, 9);
Vozila[v][mMats] = cache_get_row_int(0, 10);
Vozila[v][mDrugs] = cache_get_row_int(0, 11);
Vozila[v][mRegistracija] = cache_get_row_int(0, 12);
if(Vozila[v][mRegistracija])
{
cache_get_field_content(0, "Tablice", Vozila[v][mTablice], connection, 24);
}
Kilometraza[v] = cache_get_row_int(0, 14);
TipGoriva[v] = cache_get_row_int(0, 15);
Vozila[v][mBroj] = cache_get_row_int(0, 16);
cache_get_field_content(0, "Vlasnik", Vozila[v][mVlasnik], connection, 24);
}
return 1;
}
Код:
format(szString, sizeof(szString), true, "SELECT * FROM `Vozila`"); mysql_function_query(connection, szString, "LoadCars", "");

