MySQL loading
#1

Hello everyone, I've made houses system based on a MySQL table.

So my problem is that, my house stops loading houses after loading an owned house.
Example: House ID 0 isn't owned. House ID 1 isn't owned. House ID 2 is owned. House ID 3 is not owned.

My script loads ID 0 and 1 and 2, but it doesn't load the 3rd one because an owned house was loaded before. (House ID 2)

Another example: house ID 0 isn't owned. House ID 1 is owned, house ID 2 isn't owned.
It will load ID 0, then ID 1 but it won't load ID 2 because an owned house was loaded before (House ID 1)

And if the first house in the table is owned, it will load it ONLY, it won't load the other houses on the table.
I'm serious and I can't find the bug, here's my loading script:

So in short, here's the problem: It keeps loading houses, and when the system loads an owned house, it will stop loading, it's like the owned house is the last house in the table.
PHP код:
forward LoadHouses();
public 
LoadHouses()
{
    new 
rowsfields;
     
cache_get_data(rowsfieldsmysql);
    if(
rows)
    {
        new 
housepw[4], housetitle[MAX_HOUSE_NAME];
        for(new 
0cache_get_row_count(); i++)
        {
            
hInfo[i][hID] = cache_get_row_int(i0);
            
cache_get_row(i2housetitle);
            
cache_get_row(i3housepw);
            
            
hInfo[i][hOwner] = cache_get_row_int(i1);
            
hInfo[i][hInterior] = cache_get_row_int(i10);
            
hInfo[i][hPrice] = cache_get_row_int(i11);
            
hInfo[i][hEnterX] = cache_get_row_float(i4);
            
hInfo[i][hEnterY] = cache_get_row_float(i5);
            
hInfo[i][hEnterZ] = cache_get_row_float(i6);
            
hInfo[i][hExitX] = cache_get_row_float(i7);
            
hInfo[i][hExitY] = cache_get_row_float(i8);
            
hInfo[i][hExitZ] = cache_get_row_float(i9);
            
hInfo[i][hTitle] = housetitle;
            
hInfo[i][hPassword] = housepw;
            
hInfo[i][hWorldID] = hInfo[i][hID];
            
            new 
hEntStr[200];
            if(
hInfo[i][hOwner] == -1)
            {
                
format(hEntStrsizeof(hEntStr), ""COL_GOLD"House: "COL_WHITE"%s(%d)\n"COL_GOLD"Owner: "COL_WHITE"No-one\n"COL_GOLD"Price: "COL_WHITE"$%s"hInfo[i][hTitle], iAC(hInfo[i][hPrice]));
            }
            else if(
hInfo[i][hOwner] != -1)
            {
                
format(hEntStrsizeof(hEntStr), ""COL_GOLD"House: "COL_WHITE"%s(%d)\n"COL_GOLD"Owner: "COL_WHITE"%s\n"COL_GOLD"Price: "COL_WHITE"$%s"hInfo[i][hTitle], iGetNameFromMySQLID(hInfo[i][hOwner]), AC(hInfo[i][hPrice]));
            }
            
hInfo[i][sEnterLabel] = CreateDynamic3DTextLabel(hEntStr, -1hInfo[i][hEnterX], hInfo[i][hEnterY], hInfo[i][hEnterZ], 20.0INVALID_PLAYER_IDINVALID_VEHICLE_ID1, -10, -1100.0);
            
hInfo[i][sExitLabel] = CreateDynamic3DTextLabel(""COL_GOLD"[EXIT]", -1hInfo[i][hExitX], hInfo[i][hExitY], hInfo[i][hExitZ], 20.0INVALID_PLAYER_IDINVALID_VEHICLE_ID1hInfo[i][hWorldID], hInfo[i][hInterior], -1100.0);
            
hInfo[i][hEnterCP] = CreateDynamicCP(hInfo[i][hEnterX], hInfo[i][hEnterY], hInfo[i][hEnterZ], 1.0, -10, -1100.0);
            
hInfo[i][hExitCP] = CreateDynamicCP(hInfo[i][hExitX], hInfo[i][hExitY], hInfo[i][hExitZ], 1.0hInfo[i][hWorldID], hInfo[i][hInterior], -1100.0);
               
LoadedHouses++;
        }
        
printf("Loaded %d houses"LoadedHouses);
    }
    else if(!
rows)
    {
        
printf("There are NO houses to load");
    }
    return 
1;

Reply


Messages In This Thread
MySQL loading - by Ahmed21 - 26.07.2016, 18:24
Re: MySQL loading - by Konstantinos - 26.07.2016, 18:36
Re: MySQL loading - by Ahmed21 - 26.07.2016, 18:44
Re: MySQL loading - by Ahmed21 - 26.07.2016, 18:50
Re: MySQL loading - by Konstantinos - 26.07.2016, 19:24
Re: MySQL loading - by PrO.GameR - 26.07.2016, 22:13
Re: MySQL loading - by Ahmed21 - 27.07.2016, 07:17
Re: MySQL loading - by Ahmed21 - 27.07.2016, 09:35
Re: MySQL loading - by Konstantinos - 27.07.2016, 09:40
Re: MySQL loading - by Ahmed21 - 27.07.2016, 09:54

Forum Jump:


Users browsing this thread: 1 Guest(s)