06.04.2013, 08:03
Good morning,
I got this code for loading houses:
And the thing is that only 1 text label appears. HouseCount prints 8 (correct). There are more houses that one.
I got this code for loading houses:
pawn Код:
forward OnHouseLoad();
public OnHouseLoad()
{
new rows,fields;
cache_get_data(rows,fields,dbHandle);
for(new i; i < rows; i++)
{
new tmp[16];
HouseInfo[i][houseid]=strval(tmp);
cache_get_row(0,1,HouseInfo[i][Owner],dbHandle);
cache_get_row(0,2,tmp,dbHandle);
HouseInfo[i][Owned] = strval(tmp);
cache_get_row(0,3,tmp,dbHandle);
HouseInfo[i][Price] = strval(tmp);
cache_get_row(0,4,tmp,dbHandle);
HouseInfo[i][enX] = floatstr(tmp);
cache_get_row(0,5,tmp,dbHandle);
HouseInfo[i][enY] = floatstr(tmp);
cache_get_row(0,6,tmp,dbHandle);
HouseInfo[i][enZ] = floatstr(tmp);
cache_get_row(0,7,tmp,dbHandle);
HouseInfo[i][exX] = floatstr(tmp);
cache_get_row(0,8,tmp,dbHandle);
HouseInfo[i][exY] = floatstr(tmp);
cache_get_row(0,9,tmp,dbHandle);
HouseInfo[i][exZ] = floatstr(tmp);
cache_get_row(0,10,tmp,dbHandle);
HouseInfo[i][Interior] = strval(tmp);
cache_get_row(0,11,tmp,dbHandle);
HouseInfo[i][VirtualWorld] = strval(tmp);
cache_get_row(0,13,tmp,dbHandle);
HouseInfo[i][Locked] = strval(tmp);
new labelstring[128];
if(HouseInfo[i][Owned]==0) {format(labelstring,sizeof(labelstring),"Kaina: %d",HouseInfo[i][Price]);}
else if(HouseInfo[i][Owned]==1) {format(labelstring,sizeof(labelstring),"Savininkas: %s",HouseInfo[i][Owner]);}
HouseInfo[i][HouseLabel]=Create3DTextLabel(labelstring,0x00FF00FF,HouseInfo[i][enX],HouseInfo[i][enY],HouseInfo[i][enZ],25,HouseInfo[i][VirtualWorld]);
HouseCount++;
printf("%d",HouseCount);
}
return 1;
}