SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 20/04/2009, 01:17 AM   #1
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Issue creating file

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??
Joe Staff is offline  
Old 20/04/2009, 01:54 AM   #2
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: Issue creating file

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?
Joe Staff is offline  
Old 20/04/2009, 01:57 AM   #3
ICECOLDKILLAK8
High-roller
 
Join Date: Aug 2008
Posts: 1,154
Reputation: 5
Default Re: Issue creating file

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
__________________
IVMP
ICECOLDKILLAK8 is offline  
Old 20/04/2009, 02:04 AM   #4
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: Issue creating file

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.
Joe Staff is offline  
Old 20/04/2009, 02:20 AM   #5
Francis[French]
Huge Clucker
 
Join Date: Jun 2007
Posts: 249
Reputation: 0
Default Re: Issue creating file

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
Francis[French] is offline  
Old 20/04/2009, 02:26 AM   #6
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: Issue creating file

Yeah I use YSF's plugin which has directory creating functions

Have fun scripting.
Joe Staff is offline  
Old 20/04/2009, 02:43 AM   #7
Francis[French]
Huge Clucker
 
Join Date: Jun 2007
Posts: 249
Reputation: 0
Default Re: Issue creating file

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
Francis[French] is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating the map file before being able to create objects? -Rebel Son- Help Archive 0 30/04/2010 08:33 PM
Failed (plugins/whirlpool: cannot open shared object file: No such file or direc shotyoudie Server Support 1 19/03/2010 12:20 AM
Loading / Creating Pickups from a file ? mannen55 Help Archive 1 02/02/2010 08:11 AM
File saving, case issue on Linux. Gappy Help Archive 0 08/12/2009 10:29 AM
Wierd File Issue [FIXED] Brendan_Thomson Help Archive 1 01/07/2009 06:59 AM


All times are GMT. The time now is 05:51 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.