[Help] Loading Houses from a .ini file -
Maxips2 - 08.07.2010
Alright, I've started working on a house system.
I've created a public for it, the public's job is to load houses details (XYZ, Owner and shit)
the thing is that its loading the same house all over and over.
I mean that it loads the exact amount that I want (using loops) but its loading the same house
it means that it creates the same house at the same XYZ, with the same owner, same lock and stuff like that
this is how the loop goes:
new file[128];
format(file, 128, "LVRP/Properties/Houses/Houses.ini");
for(new h = 1; h < sizeof(HouseInfo); h++)
(Couldn't QUOTE it, dunno why)
Anyway, if you need any further details about that public, I will give it to you.
Re: [Help] Loading Houses from a .ini file -
Maxips2 - 08.07.2010
Bump.....
Re: [Help] Loading Houses from a .ini file -
CAR - 08.07.2010
usage the [ pawn] [/ pawn] tags and for this:
pawn Код:
for(new h = 1; h < sizeof(HouseInfo); h++)
you can use this:
pawn Код:
for(new h = 1; h < MAX_HOUSES; h++)
And on top :
pawn Код:
#define MAX_HOUSES 200 //or something
Re: [Help] Loading Houses from a .ini file -
Maxips2 - 08.07.2010
I've already tried that, same result.
Re: [Help] Loading Houses from a .ini file -
RichyB - 08.07.2010
What are the House Info your loading for example, if you were to load the House X Y Z Entrance?
Re: [Help] Loading Houses from a .ini file -
CAR - 08.07.2010
Your houses are loaded from that file, so how do you use that? Like in the file:
Код:
posx,posy,posz,interior,inx,iny,inz, and so on
And what's the code after: for(new h=1; h<....)
Re: [Help] Loading Houses from a .ini file -
Maxips2 - 08.07.2010
This is what the .ini file includes (it was made for tests b4):
Enterance_X=1365.420898
Enterance_Y=1974.188232
Enterance_Z=11.460900
OWned=0
Owner=None
Price=200
Exit_X=2233.7600
Exit_Y=-1115.2631
Exit_Z=1050.8828
Interior=1
World=1
Enterance_X=1364.2799
Enterance_Y=1931.6750
Enterance_Z=11.4683
OWned=0
Owner=None
Price=200
Exit_X=2233.7600
Exit_Y=-1115.2631
Exit_Z=1050.8828
Interior=1
World=1
those are the lines after the loop:
pawn Код:
HouseInfo[h][hEntrancex] = dini_Float(file, "Enterance_X");
HouseInfo[h][hEntrancey] = dini_Float(file, "Enterance_Y");
HouseInfo[h][hEntrancez] = dini_Float(file, "Enterance_Z");
HouseInfo[h][hOwned] = dini_Int(file, "Owned");
HouseInfo[h][hOwner] = dini_Int(file, "Owner");
HouseInfo[h][hPrice] = dini_Int(file, "Price");
HouseInfo[h][hExitx] = dini_Float(file, "Exit_X");
HouseInfo[h][hExity] = dini_Float(file, "Exit_Y");
HouseInfo[h][hExitz] = dini_Float(file, "Exit_Z");
HouseInfo[h][hInterior] = dini_Int(file, "Interior");
HouseInfo[h][hVirtualWorld] = dini_Int(file, "World");
Re: [Help] Loading Houses from a .ini file -
TouR - 08.07.2010
I use cfg files for this i suggest you to do this
Re: [Help] Loading Houses from a .ini file -
Maxips2 - 08.07.2010
No real difference between .cfg and .ini
Re: [Help] Loading Houses from a .ini file -
CAR - 08.07.2010
I think you can better use files: house1.ini, house2.ini so:
pawn Код:
new file[128];
for(new h = 1; h < sizeof(HouseInfo); h++)
{
format(file, 128, "LVRP/Properties/Houses/House%d.ini", h);
if(dini_Exists(file))
{
HouseInfo[h][hEntrancex] = dini_Float(file, "Enterance_X");
HouseInfo[h][hEntrancey] = dini_Float(file, "Enterance_Y");
HouseInfo[h][hEntrancez] = dini_Float(file, "Enterance_Z");
HouseInfo[h][hOwned] = dini_Int(file, "Owned");
HouseInfo[h][hOwner] = dini_Int(file, "Owner");
HouseInfo[h][hPrice] = dini_Int(file, "Price");
HouseInfo[h][hExitx] = dini_Float(file, "Exit_X");
HouseInfo[h][hExity] = dini_Float(file, "Exit_Y");
HouseInfo[h][hExitz] = dini_Float(file, "Exit_Z");
HouseInfo[h][hInterior] = dini_Int(file, "Interior");
HouseInfo[h][hVirtualWorld] = dini_Int(file, "World");
}
}
And create houses in House1.ini, House2.ini, House3.ini etc.
Edit
House1.ini:
Код:
Enterance_X=1365.420898
Enterance_Y=1974.188232
Enterance_Z=11.460900
OWned=0
Owner=None
Price=200
House2.ini:
Код:
Exit_X=2233.7600
Exit_Y=-1115.2631
Exit_Z=1050.8828
Interior=1
World=1
House3.ini:
Код:
Enterance_X=1364.2799
Enterance_Y=1931.6750
Enterance_Z=11.4683
OWned=0
Owner=None
Price=200
House4.ini:
Код:
Exit_X=2233.7600
Exit_Y=-1115.2631
Exit_Z=1050.8828
Interior=1
World=1