loadVehicles();
loadVehicles(){new query[128];format(query,sizeof(query),\"SELECT * FROM sveh\");mysql_function_query(dbhandle,query,true,\"OnQueryFinish\",\"i\",THREAD_LOAD_VEHICLES);return 1;}
public OnQueryFinish(resultid, extraid, ConnectionHandle){new num_rows, num_fields;if(resultid != THREAD_NO_RESULT){cache_get_data(num_rows, num_fields);}switch(resultid){ case THREAD_LOAD_VEHICLES: { if(num_rows) { new v; for(new i = 0; i < num_rows ; i++) { cInfo[vID] = cache_get_field_content_int(i,\"id\",dbhandle); cInfo[vModel] = cache_get_field_content_int(i,\"VehModel\",dbhandle); cInfo[vPosX] = cache_get_field_content_float(i,\"VehX\",dbhandle); cInfo[vPosY] = cache_get_field_content_float(i,\"VehY\",dbhandle); cInfo[vPosZ] = cache_get_field_content_float(i,\"VehZ\",dbhandle); cInfo[vRot] = cache_get_field_content_float(i,\"VehRot\",dbhandle); cInfo[vCol1] = cache_get_field_content_int(i,\"VehCol1\",dbhandle); cInfo[vCol2] = cache_get_field_content_int(i,\"VehCol2\",dbhandle); CreateVehicle(cInfo[vModel],cInfo[vPosX],cInfo[vPosY],cInfo[vPosZ],cInfo[vRot],cInfo[vCol1],cInfo[vCol2],-1); cInfo[vID]++; v++; printf(\"Jarmuvek betoltve: %d\", v); } } printf(\"Jarmuvek betoltve: 0\");}}return 1;}
public OnQueryFinish(resultid, extraid, ConnectionHandle){new num_rows, num_fields;if(resultid != THREAD_NO_RESULT){cache_get_data(num_rows, num_fields);}switch(resultid){ case THREAD_LOAD_VEHICLES: { if(num_rows) { new v; for(new i = 0; i < num_rows ; i++) { v = cache_get_field_content_int(i,\"id\",dbhandle); cInfo[v][vModel] = cache_get_field_content_int(i,\"VehModel\",dbhandle); cInfo[v][vPosX] = cache_get_field_content_float(i,\"VehX\",dbhandle); cInfo[v][vPosY] = cache_get_field_content_float(i,\"VehY\",dbhandle); cInfo[v][vPosZ] = cache_get_field_content_float(i,\"VehZ\",dbhandle); cInfo[v][vRot] = cache_get_field_content_float(i,\"VehRot\",dbhandle); cInfo[v][vCol1] = cache_get_field_content_int(i,\"VehCol1\",dbhandle); cInfo[v][vCol2] = cache_get_field_content_int(i,\"VehCol2\",dbhandle); cInfo[v][vID] = CreateVehicle(cInfo[v][vModel],cInfo[v][vPosX],cInfo[v][vPosY],cInfo[v][vPosZ],cInfo[v][vRot],cInfo[v][vCol1],cInfo[v][vCol2],-1); printf(\"Jarmuvek betoltve: %d\", num_rows); } } else printf(\"Jarmuvek betoltve: 0\");}}return 1;}