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;
}
mysql_debug(1);
pawn Код:
After the query, type: mysql_store_result(); It should then work, since it's getting data from nothing there. |
[14:06:16] ProcessQueryThread(OnHouseLoad) - Executing query SELECT * FROM houses...
[14:06:16] ProcessQueryThread(OnHouseLoad) - Query was successful.
[14:06:16] ProcessQueryThread(OnHouseLoad) - Data caching enabled.
[14:06:16] CMySQLHandler::StoreResult() - Result was stored.
[14:06:16] CMySQLHandler::FreeResult() - Result was successfully freed.
[14:06:16] ProcessQueryThread(OnHouseLoad) - Data being passed to ProcessTick().
[14:06:16] OnHouseLoad() - Callback is being called...
[14:06:16] >> cache_get_data(Connection handle: 1)
[14:06:16] ProcessTick() - The cache has been cleared.
HouseInfo[i][houseid]=strval(tmp);
cache_get_row(i,0,tmp,dbHandle); HouseInfo[i+1][houseid]=strval(tmp);