Issue creating file -
Joe Staff - 20.04.2009
I'm making a multisectional log and I've hit a snag with writing a file.
right now it's in 2 parts, general log and kills-deaths log. General Log works just fine, but in the same exact directory, Kills-Deaths causes a server crash, I can write the same thing in it, I can shorten the name, but it still crashes when I try to create the file in the same directory.
pawn Code:
new FileName[150];
new month[3],day,year;
GetMonthName(month);
getdate(year,day,day);
format(FileName,sizeof(FileName),"User Files/%s/%s-%d-%d/General.ini",PlayerName,month,day,year);
new File:file = fopen(FileName,io_append);
new string[300];
new hour,minute,second;
gettime(hour,minute,second);
format(string,sizeof(string),"[%02d:%02d:%02d] %s kills %s with %s\n",hour,minute,second,SenderName,PlayerName,text);
fwrite(file,string);
fclose(file);
that works
pawn Code:
new DeathFile[150];
format(DeathFile,sizeof(DeathFile),"User Files/%s/%s-%d-%d/Kills-Deaths.ini",PlayerName,month,day,year);
new File:file1 =fopen(DeathFile,io_append);
new weaponname[20];
new Float:tmp,Float:tmp2,Float:tmp3,Float:tmp4;
gettime(hour,minute,second);
format(string,sizeof(string),"-----[%02d:%02d:%02d]-----\n",hour,minute,second);
fwrite(file1,string);
that doesn't...
why?
EDIT** If I remove the first one, the second works fine... What the forizzle??
Re: Issue creating file -
Joe Staff - 20.04.2009
Hmm, I split up the files by putting the second into a separate public function and it works now.
Does that count as a pawn bug?
Re: Issue creating file -
ICECOLDKILLAK8 - 20.04.2009
Quote:
Originally Posted by SilentHuntR
Hmm, I split up the files by putting the second into a separate public function and it works now.
Does that count as a pawn bug?
|
No it counts as incorrect scripting
Re: Issue creating file -
Joe Staff - 20.04.2009
Want to elaborate on that?
I hadn't done anything wrong, I could run but not the other, no matter which one. They both had variables to run off of they just could not run consecutively.
EDIT** It may be the fact I'm running the server on my laptop for testing, but I assure you it is not my scripting. I've re-enacted the bug 3 more times in different situations.
Re: Issue creating file -
Francis[French] - 20.04.2009
Hi there,
SA-MP is
not able to create new directories. So you can't use special things such as dates in a folder, you can in the file name, but not in the folder name as it would be dynamic and you would need to create the folder yourself each time you start the server.
Have fun scripting.
Kind regards,
Francis Morissette
SA-MP Scripter
http://sa-mp.com
Re: Issue creating file -
Joe Staff - 20.04.2009
Yeah I use YSF's plugin which has directory creating functions
Have fun scripting.
Re: Issue creating file -
Francis[French] - 20.04.2009
Quote:
Originally Posted by SilentHuntR
Have fun scripting.
|
Hi there,
Hehe. ^^
Have fun scripting.
Kind regards,
Francis Morissette
SA-MP Scripter
http://sa-mp.com