BlueG MySQL only loading 1 row
#9

Quote:
Originally Posted by UFF
Посмотреть сообщение
Код:
public OnGameModeInit()
{
    ....
    mysql_tquery(g_SQL, "SELECT * FROM houses", "Query_LoadHouses", "");
    ....
}

public Query_LoadHouses()
{
    new rows = cache_num_rows();
    mysql_store_result();
    if(rows)
  	{
    for(new i; i < rows; i++)
    {
            new h;
            h = cache_get_field_content_int(i, "ID");
            cache_get_field_content(i, "OwnerID", HouseInfo[h][HouseOwnerID]);
            HouseInfo[h][HouseMarketPrice] = cache_get_field_content_int(i, "hpass");
            HouseInfo[h][HouseExteriorX] = cache_get_field_content_float(i, "ExteriorX");
            HouseInfo[h][HouseExteriorY] = cache_get_field_content_float(i, "ExteriorY");
            HouseInfo[h][HouseExteriorZ] = cache_get_field_content_float(i, "ExteriorZ");
            HouseInfo[h][HouseExteriorA] = cache_get_field_content_float(i, "ExteriorA");
            HouseInfo[h][HouseExteriorInt] = cache_get_field_content_int(i, "ExteriorInt")
            HouseInfo[h][HouseExteriorVW] = cache_get_field_content_int(i, "ExteriorVW")
            HouseInfo[h][HouseInteriorX] = cache_get_field_content_float(i, "InteriorX");
            HouseInfo[h][HouseInteriorY] = cache_get_field_content_float(i, "InteriorY");
            HouseInfo[h][HouseInteriorZ] = cache_get_field_content_float(i, "InteriorZ");
            HouseInfo[h][HouseInteriorA] = cache_get_field_content_float(i, "InteriorA");
            HouseInfo[h][HouseInteriorInt] = cache_get_field_content_int(i, "InteriorInt");
            HouseInfo[h][HouseLocked] = cache_get_field_content_int(i, "Locked");
            HouseInfo[h][HouseCashBox] = cache_get_field_content_int(i, "CashBox");

            // I rrly do not like this code, but having a loop made the compiler cry :(
            cache_get_value_int(i, "Weapons0", HouseInfo[h][HouseWeapons][0]);
            cache_get_value_int(i, "Weapons1", HouseInfo[h][HouseWeapons][1]);
            cache_get_value_int(i, "Weapons2", HouseInfo[h][HouseWeapons][2]);
            cache_get_value_int(i, "Weapons3", HouseInfo[h][HouseWeapons][3]);
            cache_get_value_int(i, "Weapons4", HouseInfo[h][HouseWeapons][4]);
            cache_get_value_int(i, "Weapons5", HouseInfo[h][HouseWeapons][5]);
            cache_get_value_int(i, "Weapons6", HouseInfo[h][HouseWeapons][6]);
            cache_get_value_int(i, "Weapons7", HouseInfo[h][HouseWeapons][7]);
            cache_get_value_int(i, "Weapons8", HouseInfo[h][HouseWeapons][8]);
            cache_get_value_int(i, "Weapons9", HouseInfo[h][HouseWeapons][9]);
            cache_get_value_int(i, "Weapons10", HouseInfo[h][HouseWeapons][10]);
            cache_get_value_int(i, "Weapons11", HouseInfo[h][HouseWeapons][11]);
            cache_get_value_int(i, "Weapons12", HouseInfo[h][HouseWeapons][12]);
            cache_get_value_int(i, "Weapons13", HouseInfo[h][HouseWeapons][13]);
            cache_get_value_int(i, "Weapons14", HouseInfo[h][HouseWeapons][14]);
            cache_get_value_int(i, "Weapons15", HouseInfo[h][HouseWeapons][15]);
            cache_get_value_int(i, "Weapons16", HouseInfo[h][HouseWeapons][16]);
            cache_get_value_int(i, "Weapons17", HouseInfo[h][HouseWeapons][17]);
            cache_get_value_int(i, "Weapons18", HouseInfo[h][HouseWeapons][18]);
            cache_get_value_int(i, "Weapons19", HouseInfo[h][HouseWeapons][19]);
            cache_get_value_int(i, "Weapons20", HouseInfo[h][HouseWeapons][20]);

            // I rrly do not like this code, but having a loop made the compiler cry :(
            cache_get_value_int(i, "WeaponsAmmo0", HouseInfo[h][HouseWeaponsAmmo][0]);
            cache_get_value_int(i, "WeaponsAmmo1", HouseInfo[h][HouseWeaponsAmmo][1]);
            cache_get_value_int(i, "WeaponsAmmo2", HouseInfo[h][HouseWeaponsAmmo][2]);
            cache_get_value_int(i, "WeaponsAmmo3", HouseInfo[h][HouseWeaponsAmmo][4]);
            cache_get_value_int(i, "WeaponsAmmo5", HouseInfo[h][HouseWeaponsAmmo][5]);
            cache_get_value_int(i, "WeaponsAmmo6", HouseInfo[h][HouseWeaponsAmmo][6]);
            cache_get_value_int(i, "WeaponsAmmo7", HouseInfo[h][HouseWeaponsAmmo][7]);
            cache_get_value_int(i, "WeaponsAmmo8", HouseInfo[h][HouseWeaponsAmmo][8]);
            cache_get_value_int(i, "WeaponsAmmo9", HouseInfo[h][HouseWeaponsAmmo][9]);
            cache_get_value_int(i, "WeaponsAmmo10", HouseInfo[h][HouseWeaponsAmmo][10]);
            cache_get_value_int(i, "WeaponsAmmo11", HouseInfo[h][HouseWeaponsAmmo][11]);
            cache_get_value_int(i, "WeaponsAmmo12", HouseInfo[h][HouseWeaponsAmmo][12]);
            cache_get_value_int(i, "WeaponsAmmo13", HouseInfo[h][HouseWeaponsAmmo][13]);
            cache_get_value_int(i, "WeaponsAmmo14", HouseInfo[h][HouseWeaponsAmmo][14]);
            cache_get_value_int(i, "WeaponsAmmo15", HouseInfo[h][HouseWeaponsAmmo][15]);
            cache_get_value_int(i, "WeaponsAmmo16", HouseInfo[h][HouseWeaponsAmmo][16]);
            cache_get_value_int(i, "WeaponsAmmo17", HouseInfo[h][HouseWeaponsAmmo][17]);
            cache_get_value_int(i, "WeaponsAmmo18", HouseInfo[h][HouseWeaponsAmmo][18]);
            cache_get_value_int(i, "WeaponsAmmo19", HouseInfo[h][HouseWeaponsAmmo][19]);
            cache_get_value_int(i, "WeaponsAmmo20", HouseInfo[h][HouseWeaponsAmmo][20]);

            cache_get_value_float(i, "PlacePosX", HouseInfo[h][HousePlacePosX]);
            cache_get_value_float(i, "PlacePosY", HouseInfo[h][HousePlacePosY]);
            cache_get_value_float(i, "PlacePosZ", HouseInfo[h][HousePlacePosZ]);

            cache_get_value_int(i, "Boombox", HouseInfo[h][HouseBoombox]);
            cache_get_value_int(i, "RentFee", HouseInfo[h][HouseRentFee]);
            cache_get_value_int(i, "Rentable", HouseInfo[h][HouseRentable]);

            new query[128];
            mysql_format(g_SQL, query, sizeof query, "SELECT * FROM furniture WHERE HouseID = %d", HouseInfo[h][HouseID]);
            mysql_tquery(g_SQL, query, "OnLoadFurniture", "d", h);

            if(HouseInfo[h][HouseLocked] == 0)
                HouseInfo[h][HouseLocked] = 1;

            UpdateHousePickup(h);
            h++;
        }
    }
    mysql_free_result();
    printf("* %d houses were loaded from the database.", rows);
    return 1;
}
try this
That will not work, I'm using R40-4, you're using an the API of an older (incompaitable) version of MySQL.
Reply


Messages In This Thread
BlueG MySQL only loading 1 row [SOLVED] - by seanny - 23.04.2018, 20:57
Re: BlueG MySQL only loading 1 row - by AmigaBlizzard - 23.04.2018, 21:05
Re: BlueG MySQL only loading 1 row - by seanny - 23.04.2018, 21:08
Re: BlueG MySQL only loading 1 row - by Phreak - 23.04.2018, 21:09
Re: BlueG MySQL only loading 1 row - by seanny - 23.04.2018, 21:11
Re: BlueG MySQL only loading 1 row - by Logic_ - 24.04.2018, 09:27
Re: BlueG MySQL only loading 1 row - by seanny - 24.04.2018, 15:58
Re: BlueG MySQL only loading 1 row - by UFF - 24.04.2018, 16:47
Re: BlueG MySQL only loading 1 row - by seanny - 24.04.2018, 17:11
Re: BlueG MySQL only loading 1 row - by Phreak - 24.04.2018, 17:28

Forum Jump:


Users browsing this thread: 1 Guest(s)