10.05.2013, 10:31
So okay, I'm using the R7 and tried creating this loading:
But guess what, that printf prints out 0!
I'm sure that the first field is right in the table and not null. Any ideas? Or am i doing something wrong?
pawn Код:
stock LoadHouses()
{
new query[25];
format(query,sizeof(query),"SELECT * FROM houses");
mysql_function_query(dbHandle,query,true,"OnHouseLoad","");
return 1;
}
forward OnHouseLoad();
public OnHouseLoad()
{
new rows,fields;
cache_get_data(rows,fields,dbHandle);
for(new i; i < rows; i++)
{
new tmp[32];
HouseInfo[i][houseid]=strval(tmp);
cache_get_row(i,0,tmp,dbHandle); HouseInfo[i+1][houseid]=strval(tmp);
cache_get_row(i,1,tmp,dbHandle); format(HouseInfo[i+1][Owner],sizeof(tmp),tmp);
cache_get_row(i,2,tmp,dbHandle); HouseInfo[i+1][Owned] = strval(tmp);
cache_get_row(i,3,tmp,dbHandle); HouseInfo[i+1][Price] = strval(tmp);
cache_get_row(i,4,tmp,dbHandle); HouseInfo[i+1][enX] = floatstr(tmp);
cache_get_row(i,5,tmp,dbHandle); HouseInfo[i+1][enY] = floatstr(tmp);
cache_get_row(i,6,tmp,dbHandle); HouseInfo[i+1][enZ] = floatstr(tmp);
cache_get_row(i,7,tmp,dbHandle); HouseInfo[i+1][exX] = floatstr(tmp);
cache_get_row(i,8,tmp,dbHandle); HouseInfo[i+1][exY] = floatstr(tmp);
cache_get_row(i,9,tmp,dbHandle); HouseInfo[i+1][exZ] = floatstr(tmp);
cache_get_row(i,10,tmp,dbHandle); HouseInfo[i+1][Interior] = strval(tmp);
cache_get_row(i,11,tmp,dbHandle); HouseInfo[i+1][VirtualWorld] = strval(tmp);
cache_get_row(i,13,tmp,dbHandle); HouseInfo[i+1][Locked] = strval(tmp);
new labelstring[128];
printf("%d",HouseInfo[i][houseid]);
if(HouseInfo[i+1][Owned]==0) {format(labelstring,sizeof(labelstring),"Kaina: %d",HouseInfo[i+1][Price]); }
else if(HouseInfo[i+1][Owned]==1) {format(labelstring,sizeof(labelstring),"Savininkas: %s",HouseInfo[i+1][Owner]);}
HouseInfo[i+1][HouseLabel]=Create3DTextLabel(labelstring,0x00FF00FF,HouseInfo[i+1][enX],HouseInfo[i+1][enY],HouseInfo[i+1][enZ],25,HouseInfo[i+1][VirtualWorld]);
HouseCount++;
}
return 1;
}
I'm sure that the first field is right in the table and not null. Any ideas? Or am i doing something wrong?