How to load stuff from mysql using a loop, to load alot of stuff at once
#6

Try something like this:
pawn Код:
forward OnVehicleLoad();
public OnVehicleLoad()
{
    for(new i, j = cache_get_row_count(g_Read); i < j; i++) // loop through all the rows that were found
    {
        VehInfo[i][VehicleID] = cache_get_field_content_int(i, "VehicleID");
        VehInfo[i][RentCash] = cache_get_field_content_int(i, "RentCash");
        VehInfo[i][Col1] = cache_get_field_content_int(i, "Col1");
        VehInfo[i][Col2] = cache_get_field_content_int(i, "Col2");
        VehInfo[i][Model] = cache_get_field_content_int(i, "Model");
        VehInfo[i][PosX] = cache_get_field_content_float(i, "PosX");
        VehInfo[i][PosY] = cache_get_field_content_float(i, "PosY");
        VehInfo[i][PosZ] = cache_get_field_content_float(i, "PosZ");
        VehInfo[i][RotZ] = cache_get_field_content_float(i, "RotZ");

        VehInfo[i][RentAvailable] = CreateVehicle(VehInfo[i][Model], VehInfo[i][PosX], VehInfo[i][PosY], VehInfo[i][PosZ], VehInfo[i][RotZ], VehInfo[i][Col1], VehInfo[i][Col2], -1);
    }
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)