Load from scriptfile
#1

Removed
Reply
#2

What do you use to save it? The default file functions?
In that case, you can find lots of tutorials both here and at the wiki on how to read files using fread.
Reply
#3

Removed
Reply
#4

U must use file system ( y_ini, dini, fini, etc) FileSet FileGet FileReplaceLine
Show property enum

1. What if player sells property ?
2. What if another player buys my property ?
Reply
#5

You can use "fread" function to load them. I recommend you to use y_INI or DJSON in these things for faster execution and makes it easier.
Reply
#6

You can do a while loop with the function fread, like so
pawn Код:
new
    string[ 128 ]; //I'm only making 128 cells to be sure you can fit an entire line of the txtfile
while( fread( hFile, string )) //This will read line-by-line and store the line being read at the moment into the variable 'string'
{
}
Now. The content of the while loop is where you extract the information from the line. The way it's formatted, the delimiter for each information is ", ". To get each and every data by know the delimiter, you can either use a custom function called "split" (search for it) or you can use sscanf by ******:

pawn Код:
for(new i = 0; i < MAX_PROPS; i++) //replace MAX_PROPS with the number of props you've got
{
    sscanf( string, "e<p<, >s[24]fffiiis[24]>", PropInfo[i] ); //this will store all the info into propinfo
    //do your stuff
}
EDIT

Do not under ANY circumstances use my code as 1. It won't probably work. 2. It's full of flaws.
Just use my code as an "inspiration" and try searching for similar codes. I recommend searching for the keywords "sscanf fread delimiter enum"
Reply
#7

Removed
Reply
#8

I'll PM you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)