Houses in heaven
#1

Hey, I've been using this housing system for several months, this went into something now..
pawn Код:
stock LoadHouses()
{
    for(new i = 1; i < MAX_HOUSES; i++)
    {
        format(Kweri, 128, "SELECT * FROM `"Houses_Table"` WHERE HouseID = '%i'", i);
        mysql_query(Kweri);
        mysql_store_result();
        if(mysql_num_rows() == 0) continue;
        else if(mysql_num_rows() == 1)
        {
            mysql_fetch_row_format(Kweri);
            sscanf(Kweri, "e<p<|>iiis[25]iiiiffffff>", HouseInfo[i]);
            mysql_free_result();
            new lString[256];
            switch(HouseInfo[i][hOwned])
            {
                case 0:
                {
                    format(lString, sizeof(lString), "House ID: "WHITE"%i\n"BLUE"House Owned: "WHITE"No\n"BLUE"House Owner: "WHITE"None\n"BLUE"House Price: "WHITE"$%i\n", HouseInfo[i][HouseID], HouseInfo[i][hPrice]);
                    HouseInfo[i][HouseIcon] = CreateDynamicMapIcon(HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ], 31, COLOR_GREEN, 0, -1, -1, 100.0);
                    HouseInfo[i][HouseEnterPickup] = CreateDynamicPickup(1273, 23, HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ], 0, -1, -1, 100.0);
                    HouseInfo[i][Label] = CreateDynamic3DTextLabel(lString,COLOR_BLUE, HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ]+0.5, 50.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, -1, -1, 50.0);
                }
                case 1:
                {
                    format(lString,sizeof(lString), "House ID: "GREEN"%i\n"RED"House Owned: "GREEN"Yes\n"RED"House Owner: "GREEN"%s\n"RED"House Price: "GREEN"$%i\n"RED"House Locked: "GREEN"%s", HouseInfo[i][HouseID], HouseInfo[i][hOwner], HouseInfo[i][hPrice], (HouseInfo[i][hLocked] == 1) ? ("Yes") : ("No"));
                    HouseInfo[i][HouseEnterPickup] = CreateDynamicPickup(1273, 23, HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ], 0, -1, -1, 100.0);
                    HouseInfo[i][HouseIcon] = CreateDynamicMapIcon(HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ], 32, COLOR_RED, 0, 0, -1, 100.0);
                    HouseInfo[i][Label] = CreateDynamic3DTextLabel(lString, COLOR_RED, HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ]+0.5, 50.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, -1, -1, 50.0);
                    HouseInfo[i][HouseExitPickup] = CreateDynamicPickup(1273,23,HouseInfo[i][IntX], HouseInfo[i][IntY], HouseInfo[i][IntZ], HouseInfo[i][hWorld], -1, -1, 100.0);
                }
            }
            HousesCreated++;
        }
    }
    printf(".::. Loaded %i houses .::.",HousesCreated);
    return 1;
}
That's how I load the houses from the database. I tried to print the X,Y,Z positions - and they printed the house positions. But when they're created, they're mostly somewhere in the cloud or the area behind SF airport (near the tunnel connecting to LS road)..
Reply
#2

You seems to be using outdated MySQL version
Reply
#3

That's not the problem, I believe. If you can help, you can - or else please don't post useless things.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)