SA-MP Forums Archive
[HELP]dini (add new line) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]dini (add new line) (/showthread.php?tid=188913)



[HELP]dini (add new line) - Blatnoi - 09.11.2010

Hello i have
2000 .ini files in my scriptfile/vehicle folder...
all of them are car ids

here is an example of car id8 8.ini
Quote:

Model=513
X=291.244628
Y=2535.548828
Z=17.348920
Angle=180.121566
Color1=0
Color2=106

i want to add new line in all those 2000 .ini files
for example Nitro=0
Quote:

Model=513
X=291.244628
Y=2535.548828
Z=17.348920
Angle=180.121566
Color1=0
Color2=106
Nitro=0

for(new vehid; vehid < MAX_VEHICLES; vehid++)
{
code which will add new line inside .ini file for every vehid
}

so as you can understand i need (code which will add new line inside .ini file for every vehid)
+ i wan't this action to be done only once i don't need multiple Nitro=0 lines


Re: [HELP]dini (add new line) - Kwarde - 09.11.2010

Just add an "dini_IntSet" I guess :P And an "dini_Int" for the reading xD
Please note that it is better to make backups first, if it isn't working :P


Re: [HELP]dini (add new line) - lameguy - 09.11.2010

Код:
for(new i = 0; i < 2000; i ++) {
    new Filename[64];
    format(Filename, sizeof(Filename), "vehicle/id%d.ini", i);
    dini_IntSet(Filename, "Nitro", 0);
}
Make it fit to your file names and it should work.


Re: [HELP]dini (add new line) - Blatnoi - 09.11.2010

Quote:
Originally Posted by lameguy
Посмотреть сообщение
Код:
for(new i = 0; i < 2000; i ++) {
    new Filename[64];
    format(Filename, sizeof(Filename), "vehicle/id%d.ini", i);
    dini_IntSet(Filename, "Nitro", 0);
}
Make it fit to your file names and it should work.
thanx this works i was doing the same sing but without filename in dini_intset : )
thnx


Re: [HELP]dini (add new line) - Kwarde - 10.11.2010

Okay
By the way, I have a tip:
If you're not sure about something, just make a backup first, then script it, and then check it
If it's working: , else, put the backup back


Re: [HELP]dini (add new line) - Blatnoi - 10.11.2010

Kwarde
Yep thats what i'm doing ) i have over 5 backups...
2 of them are on differant hdd's , 1 of them on my cd , another one on flash memory, and last one on my mobile )) lolz =D

i'm getting crazy about backups after i lost my 2 month work on .php..... due virus
p.s.
[offtopic]
i loved your Floating Admin Island ! it's great ... i'm going to use it for events on my server


Re: [HELP]dini (add new line) - Kwarde - 10.11.2010

Quote:

Yep thats what i'm doing ) i have over 5 backups...

w00t. ps, I'm gonna use my own tip; I had a nice roleplay mode, 'bout 50% completed, COMPUTER CRASH. I need to start over.

Quote:

i loved your Floating Admin Island ! it's great ... i'm going to use it for events on my server

Thanks :P
I love it to btw, I like the elevator when it's almost at the top (when I'm in it xD)


Re: [HELP]dini (add new line) - Blatnoi - 27.11.2010

ok now i'm trying to read and check definitions in all those .ini files
this is basically what i'm doing
Код:
for(new vehid; vehid < MAX_VEHICLES; vehid++)
    {
	new Filename[64];
	format(Filename, sizeof(Filename), "vehicle/%i.ini");
	LicenseSystem[vehid][CarTeh] = dini_Int( Filename, "Teh" );
	LicenseSystem[vehid][CarTehNumber] = dini_Get( Filename, "TehNumber" );
heres anum
Код:
new LicenseSystem[MAX_DVEHICLES][TehSystem];

enum TehSystem
{
	CarTeh,
	CarTehNumber[255],
};
what i'm doing wrong ?


Re: [HELP]dini (add new line) - Kwarde - 27.11.2010

pawn Код:
format(Filename, sizeof(Filename), "vehicle/%i.ini");
must be
pawn Код:
format(Filename, sizeof(Filename), "vehicle/%i.ini", vehid);
And please use [ pawn ]PAWN CODE[ /pawn ] BBcodes instead of [ code ]
So this is now the whole fixed code:

pawn Код:
for(new vehid; vehid < MAX_VEHICLES; vehid++)
    {
    new Filename[64];
    format(Filename, sizeof(Filename), "vehicle/%i.ini", vehid);
    LicenseSystem[vehid][CarTeh] = dini_Int( Filename, "Teh" );
    LicenseSystem[vehid][CarTehNumber] = dini_Get( Filename, "TehNumber" );



Re: [HELP]dini (add new line) - Blatnoi - 27.11.2010

Kwarde
Finlay worked
if not you i was getting ready for suicide )) lolz )