MySQL Doesn't load houses
#8

Quote:
Originally Posted by Tingesport
Посмотреть сообщение
Turned on AUTO_INCREMENT on the ID row.
Not sure if this would work, but worth giving it a shot.

pawn Код:
stock LoadHouses()
{
    mysql_function_query(g_Handle, "SELECT * FROM `houses`", true, "OnLoadHouses", "");
}

forward OnLoadHouses();
public OnLoadHouses()
{
    new rows, fields, result[129], string[128];
    cache_get_data(rows, fields);

    if(!rows)
    {
        print(!"No houses found!");
        return true;
    }
   
    for(new i = 0; i != rows; i++)
    {
        cache_get_field_content(i, "ID", HouseID);
        cache_get_field_content(i, "Owner", result), format(g_HouseInfo[HouseID][hOwner], 24, result);
        cache_get_field_content(i, "OwnerID", result), g_HouseInfo[HouseID][hOwnerid] = strval(result);
        cache_get_field_content(i, "EnPosX", result), g_HouseInfo[HouseID][hEnPosX] = floatstr(result);
        cache_get_field_content(i, "EnPosY", result), g_HouseInfo[HouseID][hEnPosY] = floatstr(result);
        cache_get_field_content(i, "EnPosZ", result), g_HouseInfo[HouseID][hEnPosZ] = floatstr(result);
        cache_get_field_content(i, "ExPosX", result), g_HouseInfo[HouseID][hExPosX] = floatstr(result);
        cache_get_field_content(i, "ExPosY", result), g_HouseInfo[HouseID][hExPosY] = floatstr(result);
        cache_get_field_content(i, "ExPosZ", result), g_HouseInfo[HouseID][hExPosZ] = floatstr(result);
        cache_get_field_content(i, "Interior", result), g_HouseInfo[HouseID][hInterior] = strval(result);
        cache_get_field_content(i, "World", result), g_HouseInfo[HouseID][hWorld] = strval(result);
        cache_get_field_content(i, "Pickup", result), g_HouseInfo[HouseID][hPickup] = strval(result);
        cache_get_field_content(i, "Price", result), g_HouseInfo[HouseID][hPrice] = strval(result);
        cache_get_field_content(i, "Locked", result), g_HouseInfo[HouseID][hLocked] = strval(result);
        cache_get_field_content(i, "StreetName", result), format(g_HouseInfo[HouseID][hStreetName], 64, result);
        cache_get_field_content(i, "LabelID", result), _:g_HouseInfo[HouseID][hLabel] = strval(result);
   
        if(g_HouseInfo[HouseID][hOwned] == 0)
        {
            format(string, sizeof(string), "STREET NOT SET\nResidence of The State\nPrice: $%d", g_HouseInfo[HouseID][hPrice]);
            g_HouseInfo[HouseID][hPickup] = CreateDynamicPickup(1273, 23, g_HouseInfo[HouseID][hEnPosX], g_HouseInfo[HouseID][hEnPosY], g_HouseInfo[HouseID][hEnPosZ], 0, 0, -1, 250);
        }
        if(g_HouseInfo[HouseID][hOwned] == 1)
        {
            format(string, sizeof(string), "%s\nResidence of %s", g_HouseInfo[HouseID][hStreetName], g_HouseInfo[HouseID][hOwner]);
            g_HouseInfo[HouseID][hPickup] = CreateDynamicPickup(1318, 23, g_HouseInfo[HouseID][hEnPosX], g_HouseInfo[HouseID][hEnPosY], g_HouseInfo[HouseID][hEnPosZ], 0, 0, -1, 250);
        }
        g_HouseInfo[HouseID][hLabel] = CreateDynamic3DTextLabel(string, -1, g_HouseInfo[HouseID][hEnPosX], g_HouseInfo[HouseID][hEnPosY], g_HouseInfo[HouseID][hEnPosZ], 100, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 10.0);
    }

    printf("> %d houses have been loaded from the database.", HouseID);
    return 1;
}
Reply


Messages In This Thread
MySQL Doesn't load houses - by Tingesport - 12.05.2014, 11:22
Re: MySQL Doesn't load houses - by iZN - 12.05.2014, 11:35
Re: MySQL Doesn't load houses - by Tingesport - 12.05.2014, 11:40
Re: MySQL Doesn't load houses - by iZN - 12.05.2014, 11:49
Re: MySQL Doesn't load houses - by Tingesport - 12.05.2014, 11:54
Re: MySQL Doesn't load houses - by iZN - 12.05.2014, 12:03
Re: MySQL Doesn't load houses - by Tingesport - 12.05.2014, 12:06
Re: MySQL Doesn't load houses - by iZN - 12.05.2014, 12:12
Re: MySQL Doesn't load houses - by Tingesport - 12.05.2014, 12:19

Forum Jump:


Users browsing this thread: 2 Guest(s)