08.01.2011, 13:26
I have this code:
I create house ingame, all is perfect in database, but it just doesnt create it after restart.
Code:
function LoadSHouses() { for(new id; id < MAX_HOUSES; id++) { new DataString[128]; format( Query, sizeof( Query ), "SELECT * FROM ServerHouses WHERE id= '%d'", id); mysql_query(Query); mysql_store_result(); if(mysql_num_rows()) if(mysql_fetch_row_format(Query,"|")) { mysql_fetch_field_row(DataString,"id"); HouseInfo[id][hID] = strval(DataString); mysql_fetch_field_row(DataString,"Owned"); HouseInfo[id][hOwned] = strval(DataString); mysql_fetch_field_row(DataString,"Owner"); HouseInfo[id][hOwner] = strval(DataString); mysql_fetch_field_row(DataString,"EntranceX"); HouseInfo[id][hEntranceX] = strval(DataString); mysql_fetch_field_row(DataString,"EntranceY"); HouseInfo[id][hEntranceY] = strval(DataString); mysql_fetch_field_row(DataString,"EntranceZ"); HouseInfo[id][hEntranceZ] = strval(DataString); mysql_fetch_field_row(DataString,"ExitX"); HouseInfo[id][hExitX] = strval(DataString); mysql_fetch_field_row(DataString,"ExitY"); HouseInfo[id][hExitY] = strval(DataString); mysql_fetch_field_row(DataString,"ExitZ"); HouseInfo[id][hExitZ] = strval(DataString); mysql_fetch_field_row(DataString,"Interior"); HouseInfo[id][hInterior] = strval(DataString); mysql_fetch_field_row(DataString,"Open"); HouseInfo[id][hOpen] = strval(DataString); mysql_fetch_field_row(DataString,"Pickup"); HouseInfo[id][hPickup] = strval(DataString); mysql_fetch_field_row(DataString,"Price"); HouseInfo[id][hPrice] = strval(DataString); mysql_free_result(); } if(HouseInfo[id][hOwned] == 0) { HouseText[id] = Create3DTextLabel("Sale", COLOR_3D_GOLD, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ] + 0.6, 40.0,0); HouseInfo[id][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]); } else if(HouseInfo[id][hOwned] == 1) { HouseText[id] = Create3DTextLabel("Has owner", COLOR_3D_GOLD, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ] + 0.6, 40.0,0); HouseInfo[id][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]); } } return 1; }