[+REP] Loading MySQL houses
#4

Corrected a small error in your loading code.

PHP код:
forward Load_houses();
public 
Load_houses()
{
    new
        
rows,
        
fields;
        
    
cache_get_data(rowsfieldsmysql);
    if(
rows == 0)
    {
        
printf("No houses were found in the database.");
    }
    else
    {
        for(new 
0rowsi++)
        {
            if(
rows <= MAX_HOUSES)
            {
                
hInfo[i][hID] = cache_get_field_content_int(i"ID");
                
hInfo[i][hOwned] = cache_get_field_content_int(i"Owned");
                
hInfo[i][hPrice] = cache_get_field_content_int(i"Price");
                
hInfo[i][hEntranceX] = cache_get_field_content_float(i"EntranceX");
                
hInfo[i][hEntranceY] = cache_get_field_content_float(i"EntranceY");
                
hInfo[i][hEntranceZ] = cache_get_field_content_float(i"EntranceZ");
                
hInfo[i][hExitX] =  cache_get_field_content_float(i"ExitX");
                
hInfo[i][hExitY] =  cache_get_field_content_float(i"ExitY");
                
hInfo[i][hExitZ] =  cache_get_field_content_float(i"ExitZ");
                
hInfo[i][InteriorID] = cache_get_field_content_int(i"InteriorID");
                
cache_get_field_content(i"Pass"hInfo[i][hPass]);
                
cache_get_field_content(i"Owner"hInfo[i][hOwner]);
                
                
hInfo[i][EntranceCP] = CreateDynamicCP(hInfo[i][hEntranceX], hInfo[i][hEntranceY], hInfo[i][hEntranceZ], 1.5, -1, -1, -150.0);
                
hInfo[i][ExitCP] = CreateDynamicCP(hInfo[i][hExitX], hInfo[i][hExitY], hInfo[i][hExitZ], 1.5hInfo[i][hID], hInfo[i][InteriorID], -1100.0);
                new 
labelstring[200];
                switch(
hInfo[i][hOwned])
                {
                    case 
0:
                    {
                        
format(labelstringsizeof(labelstring), "{FFFFFF}Home(%d)\n"COL_GOLD"Owner:{FFFFFF} No-one\n"COL_GOLD"Price:{FFFFFF} %s"hInfo[i][hID], AC(hInfo[i][hPrice]));
                        
hInfo[i][HouseLabel] = CreateDynamic3DTextLabel(labelstringCOLOR_WHITEhInfo[i][hEntranceX], hInfo[i][hEntranceY], hInfo[i][hEntranceZ], 35.0INVALID_PLAYER_IDINVALID_VEHICLE_ID0, -1, -1, -135.0);
                        
                    }
                    case 
1:
                    {
                        
format(labelstringsizeof(labelstring), "{FFFFFF}Home(%d)\n"COL_GOLD"Owner:{FFFFFF} %s\n"COL_GOLD"Price:{FFFFFF} %s"hInfo[i][hID], hInfo[i][hOwner], AC(hInfo[i][hPrice]));
                        
hInfo[i][HouseLabel] = CreateDynamic3DTextLabel(labelstringCOLOR_WHITEhInfo[i][hEntranceX], hInfo[i][hEntranceY], hInfo[i][hEntranceZ], 35.0INVALID_PLAYER_IDINVALID_VEHICLE_ID0, -1, -1, -135.0);
                    }
                }
                
hInfo[i][ExitLabel] = CreateDynamic3DTextLabel("[EXIT]"COLOR_WHITEhInfo[i][hExitX], hInfo[i][hExitY], hInfo[i][hExitZ], 35.0INVALID_PLAYER_IDINVALID_VEHICLE_ID0hInfo[i][hID], -1, -135.0);
                
LoadedHouses++;
            }
        }
    }

Try that.
Reply


Messages In This Thread
[+REP] Loading MySQL houses - by E7mad - 04.02.2016, 05:41
Re: [+REP] Loading MySQL houses - by itsCody - 04.02.2016, 06:04
Re: [+REP] Loading MySQL houses - by E7mad - 04.02.2016, 06:38
Re: [+REP] Loading MySQL houses - by itsCody - 04.02.2016, 06:47
Re: [+REP] Loading MySQL houses - by DaniceMcHarley - 04.02.2016, 07:12
Re: [+REP] Loading MySQL houses - by E7mad - 04.02.2016, 07:30

Forum Jump:


Users browsing this thread: 1 Guest(s)