Simple House's script?
#1

Hi all,
I have been looking around the forum, and found no house script which is easily understandable nor editable in a simple fashion (looking at them from a noobish point of view, no offence to those of you). I would like to make one, however i dont know where to start, i understand all of the others, and see where there going, they just dont really make much sense.

The houses will be in an enum'ed' array.

pawn Код:
enum HousesInfo {houseid, x, y, z, tx, ty, tz, virtual, interior}
new Houses[][HousesInfo] = {
{0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 2} //EXAMPLE - Obviously :)
};

CreatePickup(model, type, Houses[i][HouseInfo]
And so on and so on, but my big question is... (Dun Dun Dum!)
How can i read the houses that have been bought in dini? I know how to save, open, create, delete files in DINI, however i have no knowledge of getting this information from a file with dini. This is all i really need to know, hopefully i will be releasing this script with detailed and basic editing techniques avaliable.

Thanks
Ash!
Reply
#2

dini_Get?
Reply
#3

I still use the native File functions for reading configuration files (non-player files).

You would need to make a rather large string to store all the information in the file, then open the file, then I'd use a while loop.

pawn Код:
while(fread(file, THE_LARGE_STRING))
{
//Do stuff, I use sscanf, you will see an example when my jBizz is released
}
fclose(file);
Reply
#4

Quote:
Originally Posted by Kar
Посмотреть сообщение
dini_Get?
Thanks, ill take a look... However can you explain a little bit about how to use the function?

Quote:
Originally Posted by Joe_
Посмотреть сообщение
I still use the native File functions for reading configuration files (non-player files).

You would need to make a rather large string to store all the information in the file, then open the file, then I'd use a while loop.

pawn Код:
while(fread(file, THE_LARGE_STRING))
{
//Do stuff, I use sscanf, you will see an example when my jBizz is released
}
fclose(file);
Sounds interesting, ill look into it, however from reading topics on the forum about PAWN's native file functions, they seem a bit "downgraded" from other's. I will have a go at using this though

Thanks to both of you, is there any other methods that could be used? And should i save the houses as single files for, house cars for example. So i can save cars and their location for the houses?

Thanks
Ash
Reply
#5

PAWN's native file functions are fine, it's probably just better to use an alternative like SII or DINI for user files.

I prefer using the native file functions if it's a file that contains things like coordinates, vehicles, etc.

And it's probably best to create one file for all houses, with a line that contains all the needed information, to format, look into sscanf, it's not just for commands, it works extremely well for files, a good example is in my jBizz system.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)