View Full Version : {Rep++}HouseSystem problem!!![Made with YINI;****** help,please]

09/04/2012, 07:56 AM
So,my house system works almost perfect,just that when I restart server,houses delete,and I realised why.I followed a good tutorial,and here's the piece of code I followed:

stock CreateHouse(HouseName[], CostP, Float:EnterX, Float:EnterY, Float:EnterZ, Float:TeleX, Float:TeleY, Float:TeleZ, Interiorx, SellP)
format(HouseInformation[houseid][Hname], 100, "%s", HouseName);
HouseInformation[houseid][costprice] = CostP;
HouseInformation[houseid][EnterPos][0] = EnterX;
HouseInformation[houseid][EnterPos][1] = EnterY;
HouseInformation[houseid][EnterPos][2] = EnterZ;
HouseInformation[houseid][TelePos][0] = TeleX;
HouseInformation[houseid][TelePos][1] = TeleY;
HouseInformation[houseid][TelePos][2] = TeleZ;
HouseInformation[houseid][sellprice] = SellP;
HouseInformation[houseid][interiors] = Interiorx;
format(fquery, sizeof(fquery), "SELECT houseowner FROM HOUSEINFO WHERE housename = '%s'", HouseName); //You can notice the definition of the owner in the stock HERE
queryresult = db_query(database, fquery);
if(db_num_rows(queryresult) != 0) db_get_field_assoc(queryresult, "houseowner", HouseInformation[houseid][owner], 24);
HouseInformation[houseid][checkpointidx][0] = CreateDynamicCP(EnterX, EnterY, EnterZ, 1.0);
HouseInformation[houseid][checkpointidx][1] = CreateDynamicCP(TeleX, TeleY, TeleZ, 1.0, 15500000+houseid, Interiorx);
if(!HouseInformation[houseid][owner][0]) format(fquery, sizeof(fquery), "House Name: %s \n House Price:$%d \n Sell Price: $%d", HouseName, CostP, SellP);//HERE is used the Owner variable to properly load the house
else if(HouseInformation[houseid][owner][0] != 0) format(fquery, sizeof(fquery), "House Name: %s \n Owner: %s", HouseName, HouseInformation[houseid][owner]);//SAME as before
HouseInformation[houseid][textid] = CreateDynamic3DTextLabel(fquery, 0xFFFFFF, EnterX, EnterY, EnterZ + 0.5, 50.0);
houseid ++;
return 1;

And I nicely converted that to YINI,but I have no idea how to define Owner variable in the stock,so the house would load properly[really now,MySQL is in my point of view a really strange coding language data base]:
stock CreateHouse(Price,Float:EnterX,Float:EnterY,Float: EnterZ,Float:ExitX,Float:ExitY,Float:ExitZ,Layout, Float:TeleX,Float:TeleY,Float:TeleZ)
HouseInfo[houseid][DefaultPrice] = Price;
HouseInfo[houseid][EnterPos][0] = EnterX;
HouseInfo[houseid][EnterPos][1] = EnterY;
HouseInfo[houseid][EnterPos][2] = EnterZ;
HouseInfo[houseid][ExitPos][0] = ExitX;
HouseInfo[houseid][ExitPos][1] = ExitY;
HouseInfo[houseid][ExitPos][2] = ExitZ;
HouseInfo[houseid][Interior] = Layout;
HouseInfo[houseid][TelePos][0] = TeleX;
HouseInfo[houseid][TelePos][1] = TeleY;
HouseInfo[houseid][TelePos][2] = TeleZ;
HouseInfo[houseid][hPickup] = CreatePickup(1273,1,EnterX,EnterY,EnterZ,-1);
HouseInfo[houseid][ehPickup] = CreatePickup(1272,1,ExitX,ExitY,ExitZ,-1);
new string[250];
if(!HouseInfo[houseid][Owner][0]) format(string,sizeof(string),"{FOR SELL}\nPrice:%d$",Price);
else if(HouseInfo[houseid][Owner][0] != 0)//So,HERE I "load" the house,but of course,who is the owner
if(HouseInfo[houseid][hSell]==0) format(string,sizeof(string),"Owner:%s",HouseInfo[houseid][Owner]);
else if(HouseInfo[houseid][hSell]==1) format(string,sizeof(string),"{FOR SELL}\nOwner:%s\nSell price:%d$",HouseInfo[houseid][Owner],HouseInfo[houseid][SellPrice]);
HouseInfo[houseid][hText] = Create3DTextLabel(string,COLOR_BLUE,EnterX,EnterY, EnterZ+0.5,50.0,0,0);
return 1;

Finnaly,my question is how would I be able to adapt this line of code:
format(fquery, sizeof(fquery), "SELECT houseowner FROM HOUSEINFO WHERE housename = '%s'", HouseName); to my code?

09/04/2012, 09:15 AM
Just dowload or view house scripts in filterscript section. It will help u.

09/04/2012, 09:17 AM
Don't you get it,I wanna follow tutorials,and that's the only thing I don't understand,THE ONLY,so,:P..Anyone else?[Anyway,I appreciate your help]