House loading with mysql.
#1

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?
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=159785
Reply
#3

I not need a mysql,i talk about house load with mysql...
Reply
#4

Then you need to understand how MySQL works...
https://sampforum.blast.hk/showthread.php?tid=159785
Is a great guide on how to make a MySQL system.
Reply
#5

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();
}
}
But this not work...What can be wrong here?
Reply
#6

Yes I can see that, do you have a way to contact you outside the forum?
Reply
#7

Yes, contact me with pm.
Reply
#8

Quote:
Originally Posted by budelis
Посмотреть сообщение
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();
}
}
But this not work...What can be wrong here?
Use print to determine what values it is printing. I also saw that you're not putting a value into the 3DTextLabel which isn't the best idea
Quote:

Important Note: If text[] is empty, the server/clients next to the text might crash!

I also recommend that you use one single query to get all of the information rather than multiple queries.
Reply
#9

I try print owner name,interior and this not work too....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)