Create File [REP++]
#1

Hello ,
I want to create a file to store in it all gang info but not like this
PHP код:
= ...
= ...
= .... 
Because they are 65 zone or if you know how to make 65 file so tell me in this way .
Thank You !
Reply
#2

//whenever you want to save the gangs in multiple files you just have to format the filepath;
pawn Код:
for(new i; i<NUMBER_OF_GANGS; i++)
{
    new filepath[64];
    format(filepath, sizeof(filepath), "Gangs/%d",  i);
    dini_Create(filepath);
    .. et cetra
}
or if you want to save all info in 1 file (1 line per gang) you could do something like this:
pawn Код:
new File:file=fopen("GangInfo.txt", io_append);
new str[128];
for(new i; i<NUMBER_OF_GANGS; i++)
{  
    format(str, sizeof(str), "%s %.2f %.2f %.2f \r\n", GangInfo[i][GangName], GangInfo[i][X], GangInfo[i][Y], GangInfo[i][Z]);
    fwrite(file, str);
}
fclose(file);
Reply
#3

Can you explain more for the one file i am not so good in saving
Reply
#4

I'm sorry, now that I think of it, this is not the right way to do it. I got this little piece of code from my KeepYourLane-filterscript I released a while back which saves and reads lots data(coordinates) from 1 single file. But in my script the values won't get changed, while i assume the gang-values you want to store do change, so this will not work for you. And to be honest I don't know how to do that.. I'm only familiar with dini, but that will give you lots of files.

I could explain that a bit more to you, unless you prefer someone else explain the 1-file saving system..
Reply
#5

Another thing.....
How can i load them in GangZoneCreate ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)