public AutoLaadimine() { new rows = cache_num_rows(mysql), count = 0; //let's get the rows and fields from the database. if(rows > 0) { for(new z = 0; z < rows; z++) { for(new i = 0; i < MAX_VEHICLES; i++) { MasinaInfo[i][ID] = cache_get_field_content_int(z, "ID"); MasinaInfo[i][SQLID] = cache_get_field_content_int(z, "SQLID"); cache_get_field_content(z, "Omanik", MasinaInfo[i][Omanik]); // Here is the owner name loading. MasinaInfo[i][Mudel] = cache_get_field_content_int(z, "Mudel"); MasinaInfo[i][Lukus] = cache_get_field_content_int(z, "Lukus"); MasinaInfo[i][Component][0] = cache_get_field_content_int(z, "Component0"); MasinaInfo[i][Component][1] = cache_get_field_content_int(z, "Component1"); MasinaInfo[i][Component][2] = cache_get_field_content_int(z, "Component2"); MasinaInfo[i][Component][3] = cache_get_field_content_int(z, "Component3"); MasinaInfo[i][Component][4] = cache_get_field_content_int(z, "Component4"); MasinaInfo[i][Component][5] = cache_get_field_content_int(z, "Component5"); MasinaInfo[i][Component][6] = cache_get_field_content_int(z, "Component6"); MasinaInfo[i][Component][7] = cache_get_field_content_int(z, "Component7"); MasinaInfo[i][Component][8] = cache_get_field_content_int(z, "Component8"); MasinaInfo[i][Component][9] = cache_get_field_content_int(z, "Component9"); MasinaInfo[i][Component][10] = cache_get_field_content_int(z, "Component10"); MasinaInfo[i][Component][11] = cache_get_field_content_int(z, "Component11"); MasinaInfo[i][Component][12] = cache_get_field_content_int(z, "Component12"); MasinaInfo[i][Component][13] = cache_get_field_content_int(z, "Component13"); MasinaInfo[i][Color][0] = cache_get_field_content_int(z, "Color0"); MasinaInfo[i][Color][1] = cache_get_field_content_int(z, "Color1"); MasinaInfo[i][PaintJob] = cache_get_field_content_int(z, "PaintJob"); MasinaInfo[i][vX] = cache_get_field_content_float(z, "vX"); MasinaInfo[i][vY] = cache_get_field_content_float(z, "vY"); MasinaInfo[i][vZ] = cache_get_field_content_float(z, "vZ"); MasinaInfo[i][vR] = cache_get_field_content_float(z, "vR"); MasinaInfo[i][Elud] = cache_get_field_content_float(z, "Elud"); CreateVehicle(MasinaInfo[i][Mudel], MasinaInfo[i][vX],MasinaInfo[i][vY], MasinaInfo[i][vZ], MasinaInfo[i][vR], MasinaInfo[i][Color][0], MasinaInfo[i][Color][1], -1); SetVehicleHealth(MasinaInfo[i][SQLID], MasinaInfo[i][Elud]); vCreated[i] = 1; count ++; // Here i print out owner name and sqlid. printf("Omanik: %s - SQLID: %d", MasinaInfo[i][Omanik], MasinaInfo[i][SQLID]); break; } } printf("Laetud %d autot.", count); } else { print("Ьhtegi autot ei laaditud."); } return 1; }
be sure in MasinaInfo you have used Omanik with an size to count it as string not numberic example:
enum ... { MasinaInfo[MAX_PLAYER_NAME+1]; }; |
cache_get_field_content(z, "Omanik", MasinaInfo[i][Omanik]);
cache_get_row(z,The index of the field (starts at '0'),MasinaInfo[i][Omanik],mysql,MAX_PLAYER_NAME+1];
change
PHP код:
cache_get_row(row, field_idx, destination[], connectionHandle = 1, max_len = sizeof(destination)); it would be: PHP код:
|