Help[House System]!!!
#1

OK,so I started to script a house system.Meanwhile I followed a really good tutorial,wich really helped me much.In the tutorial the database was created with SQLite,I tried to transform it inot YINI,and hopefully it'll work.By my estimations,the house system is 99% done[not tested yet due to the error mentioned bellow].So the erroris the following:

pawn Код:
#define hPATH "/HousesDB/%s.ini"
#define MAX_HOUSES 30

enum hInfo
{
   Text3D:hText,
   Owner[MAX_PLAYER_NAME],
   DefaultPrice,
   SellPrice,
   Interior,
   hSell,
   hPickup,
   Float:EnterPos[3],
   Float:TelePos[3]
}

new HouseInfo[MAX_HOUSES][hInfo];

stock HousesDB(houseid)
{
   new string[256];
   format(string,sizeof(string),hPATH,HouseInfo[houseid][Owner]);
   return string;
}

forward LoadHouse_Data(houseid,name[],value[]);

public LoadHouse_Data(houseid,name[],value[])
{
   INI_String("Owner",HouseInfo[houseid][Owner],24);
   INI_Int("SellPrice",HouseInfo[houseid][SellPrice]);
   INI_Int("Interior",HouseInfo[houseid][Interior]);
   return 1;
}

stock CreateHouse(Price,Float:EnterX,Float:EnterY,Float:EnterZ,Layout,TeleX,TeleY,TeleZ)
{
   HouseInfo[houseid][DefaulPrice] = Price;
   HouseInfo[houseid][EnterPos][0] = EnterX;
   HouseInfo[houseid][EnterPos][1] = EnterY;
   HouseInfo[houseid][EnterPos][2] = EnterZ;
   HouseInfo[houseid][Interior] = Layout;
   HouseInfo[houseid][TelePos][0] = TeleX;
   HouseInfo[hosueid][TelePos][1] = TeleY;
   HouseInfo[houseid][TelePos][2] = TeleZ;
   HouseInfo[houseid][hPickup] = CreatePickup(1273,1,EnterX,EnterY,EnterZ,0);
   HouseInfo[houseid][hSell]=0;
   new sttring[250];
   if(!HouseInfo[houseid][Owner][0]) format(string,sizeof(string),"{FOR SELL}\nPrice:%d",DefaultPrice);
   else if(HouseInfo[houseid][Owner][0] != 0)
   {
      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]);
   }
   HounseInfo[houseid][hText] = Create3DTextLabel(string,COLOR_DARKOLIVEGREEN,EnterX,EnterY,EnterZ+0.5,50.0);
   houseid++;
 return 1;
}

CreateHouse(5000,221.6365,114.6479,999.0156,5,1267.663208,-781.323242,1091.906250);//ERROR:invalid function or declaration+symbol already defined
Please,be nice and read it slowly,getting reputation if you help me!!![Why?Because this is a really important script].Why I am not showing you all the code?Will do it later if the house system won't work,after we fix this error,cause I am pretty sure the problem is in the code depicted above.
Reply
#2

What errors?
What is not working?
Reply
#3

What tells you when compile?
Reply
#4

the erros are in the last line of the code I psted the as a comment
Reply
#5

Why are u trying to put that in gm?
You need to create house from server and it will save to HouseDB..
And where do u wanna put this
Код:
CreateHouse(5000,221.6365,114.6479,999.0156,5,1267.663208,-781.323242,1091.906250);//ERROR:invalid function or declaration+symbol already defined
Reply
#6

Put it Under

Quote:

public OnGamemodeInit
CreateHouse(5000,221.6365,114.6479,999.0156,5,1267 .663208,-781.323242,1091.906250);

And Tell me if helped
Reply
#7

Well,it was already under OnGameModeInit axxelac,and all the functions related to the houe are deefined above the function as depicted in my first post :P TzAks,and the tutorial I followed was saying I must put it under OnGameModeInit,so it's still not working axxelac.Please help,if I get help from both,I will give rep both,but pls help
Reply
#8

Quote:
Originally Posted by TzAkS.
Посмотреть сообщение
Why are u trying to put that in gm?
You need to create house from server and it will save to HouseDB..
And where do u wanna put this
Код:
CreateHouse(5000,221.6365,114.6479,999.0156,5,1267.663208,-781.323242,1091.906250);//ERROR:invalid function or declaration+symbol already defined
You are wrong, every house system is different.

CJGogo try to put it in OnGameModeInit or if not create a file in scriptfiles and put all your houses in file there and link it back to your script. You will have to change your script tho to make it work.
Reply
#9

Quote:
Originally Posted by captainjohn
Посмотреть сообщение
You are wrong, every house system is different.

CJGogo try to put it in OnGameModeInit or if not create a file in scriptfiles and put all your houses in file there and link it back to your script. You will have to change your script tho to make it work.
I thought that he had and command to create the house.
But he have that function to load houses and houses is in /HousesDB/%s.ini.
Is better to create the house directly to scriptfiles becouse he don`t have something to insert it from gm to scriptfiles.
Reply
#10

that house system has not comands so why you add a house path with a string just add that createhouse at the house path and instead of a variable put house .ini file where you save the coordinates
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)