MySQL loading
#8

So, this is what I done, and now, when it loads an owned house, it sets the owner name to NULL and stops loading after loading an owned house:

I've tried to let the system show the owner acc ID, not name, and it worked well and it didn't stop loading after an owned house, but when I added that mysql shit, it stopped again.

Focus to that if(hInfo[i][hOwner] != -1) ..
PHP код:
forward LoadHouses();
public 
LoadHouses()
{
    new 
rowsfields;
     
cache_get_data(rowsfieldsmysql);
    if(
rows)
    {
        new 
housepw[4], housetitle[MAX_HOUSE_NAME];
        for(new 
0rowsi++)
        {
            
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)
            {
                   new 
query[50];
                
mysql_format(mysqlquerysizeof(query), "SELECT Name FROM accounts WHERE ID = %d LIMIT 1"hInfo[i][hOwner]);
                new 
Cacheresult mysql_query(mysqlquery);
                if (
cache_get_row_count()) cache_get_row(01query);
                
cache_delete(result);
                
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], iqueryAC(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)