Houses Load
#8

How is it supposed to know how many times it will loop if you don't execute the query before?

Anyway, I see no point on using non-threaded queries as they are slower and especially when having many rows:
pawn Код:
mysql_tquery(1, "SELECT * FROM houses", "OnHousesLoad", "");
PHP код:
forward OnHousesLoad();
public 
OnHousesLoad()
{
    for(new 
xcache_get_row_count(); != j; ++x)
    {
        if (
>= sizeof HouseInfo) break; // prevent any out of bounds run time error
        
        
HouseInfo[x][HouseID] = cache_get_field_content_int(x"id");
        
HouseInfo[x][EntranceX] = cache_get_field_content_float(x"EntranceX");
        
HouseInfo[x][EntranceY] = cache_get_field_content_float(x"EntranceY");
        
HouseInfo[x][EntranceZ] = cache_get_field_content_float(x"EntranceZ");
        
HouseInfo[x][ExitX] = cache_get_field_content_float(x"ExitX");
        
HouseInfo[x][ExitY] = cache_get_field_content_float(x"ExitY");
        
HouseInfo[x][ExitZ] = cache_get_field_content_float(x"ExitZ");
        
HouseInfo[x][InsideInt] = cache_get_field_content_int(x"InsideInt");
        
cache_get_field_content(x"owner"HouseInfo[x][owner], 1MAX_PLAYER_NAME);
        
HouseInfo[x][owned] = cache_get_field_content_int(x"owned");
        
HouseInfo[x][HousePrice] = cache_get_field_content_int(x"price");
        
cache_get_field_content(x"text"HouseInfo[x][HouseText], 1/* SIZE OF HouseText HERE */);
        
Create3DTextLabel(HouseInfo[x][HouseText], COLOR_GREENHouseInfo[x][EntranceX], HouseInfo[x][EntranceY], HouseInfo[x][EntranceZ], 3001);
    }
    return 
1;

and modify this line:
pawn Код:
cache_get_field_content(x, "text", HouseInfo[x][HouseText], 1, /* SIZE OF HouseText HERE */);
and the size you have in the enum for HouseText.
Reply


Messages In This Thread
Houses Load - by nezo2001 - 12.06.2015, 22:02
Re: Houses Load - by nezo2001 - 13.06.2015, 00:19
Re: Houses Load - by nezo2001 - 13.06.2015, 07:40
Re: Houses Load - by Konstantinos - 13.06.2015, 09:46
Re: Houses Load - by nezo2001 - 13.06.2015, 16:52
Re: Houses Load - by Konstantinos - 13.06.2015, 17:05
Re: Houses Load - by nezo2001 - 14.06.2015, 11:08
Re: Houses Load - by Konstantinos - 14.06.2015, 11:15
Re: Houses Load - by nezo2001 - 14.06.2015, 11:23

Forum Jump:


Users browsing this thread: 2 Guest(s)