16.10.2011, 07:44
Hello peoples.I need some help with my house system. I want to load my house,but i don't know how to start.Maybe somebody can give me a little code how need start?
for(new house=0; house<pickups[1][HousePickup]+1; house++) { new Query[200]; format(Query, sizeof(Query), "SELECT * FROM houses WHERE `houseid` = '%d'",house); mysql_query(Query); mysql_store_result(); new savingstring[ 20 ]; while(!mysql_retrieve_row()) { //If house pickup is not own. houseDB[house][HouseLabel] = Create3DTextLabel("",-1,HousePickups[house][0],HousePickups[house][1],HousePickups[house][2],25, 0, 1); format(text,sizeof(text),"House: %d\nPrice: %d",house,houseDB[house][nprice]); Update3DTextLabelText(houseDB[house][HouseLabel],-1,text); continue; } //If house pickup is belong for person. mysql_fetch_field_row( houseDB[house][owner_name], "Owner"); mysql_fetch_field_row( savingstring, "Interior"); houseDB[house][ninterior] = strval(savingstring); mysql_fetch_field_row( savingstring, "HouseX"); houseDB[house][HouseX] = floatstr(savingstring); mysql_fetch_field_row( savingstring, "HouseY"); houseDB[house][HouseY] = floatstr(savingstring); mysql_fetch_field_row( savingstring, "HouseZ"); houseDB[house][HouseZ] = floatstr(savingstring); houseDB[house][HouseLabel] = Create3DTextLabel("",-1,HousePickups[house][0],HousePickups[house][1],HousePickups[house][2],25, 0, 1); format(file,sizeof(file),"House: %d\nPrice: %d\nOwner: %s",house,houseDB[house][nprice],houseDB[house][owner_name]); Update3DTextLabelText(houseDB[house][HouseLabel],-1,file); mysql_free_result(); } }
I know how works mysql,but i don't know how to do it ...
Код:
for(new house=0; house<pickups[1][HousePickup]+1; house++) { new Query[200]; format(Query, sizeof(Query), "SELECT * FROM houses WHERE `houseid` = '%d'",house); mysql_query(Query); mysql_store_result(); new savingstring[ 20 ]; while(!mysql_retrieve_row()) { //If house pickup is not own. houseDB[house][HouseLabel] = Create3DTextLabel("",-1,HousePickups[house][0],HousePickups[house][1],HousePickups[house][2],25, 0, 1); format(text,sizeof(text),"House: %d\nPrice: %d",house,houseDB[house][nprice]); Update3DTextLabelText(houseDB[house][HouseLabel],-1,text); continue; } //If house pickup is belong for person. mysql_fetch_field_row( houseDB[house][owner_name], "Owner"); mysql_fetch_field_row( savingstring, "Interior"); houseDB[house][ninterior] = strval(savingstring); mysql_fetch_field_row( savingstring, "HouseX"); houseDB[house][HouseX] = floatstr(savingstring); mysql_fetch_field_row( savingstring, "HouseY"); houseDB[house][HouseY] = floatstr(savingstring); mysql_fetch_field_row( savingstring, "HouseZ"); houseDB[house][HouseZ] = floatstr(savingstring); houseDB[house][HouseLabel] = Create3DTextLabel("",-1,HousePickups[house][0],HousePickups[house][1],HousePickups[house][2],25, 0, 1); format(file,sizeof(file),"House: %d\nPrice: %d\nOwner: %s",house,houseDB[house][nprice],houseDB[house][owner_name]); Update3DTextLabelText(houseDB[house][HouseLabel],-1,file); mysql_free_result(); } } |
Important Note: If text[] is empty, the server/clients next to the text might crash! |