Raised This Month: $ Target: $400
 0% 

Data isn't written to file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 07-27-2008 , 20:28   Data isn't written to file
Reply With Quote #1

Hi!

I'm updating my plugin "Point - System" to the new file system.
Though I've never worked with the new system before so I got a problem.

The problem is within the following code.
Nothing is written to the file even when everything is correct.

With correct I mean file location, strings, variables.
I've logged everything therefor I've seen it's correct.

But still, the information won't get written to the file:
PHP Code:
add_points(indexpointssound 1)
{
    if(
is_ps_on())
    {
        if(
is_false_user(index))
            return;

        static 
steamid[2][MAX_LENGTH 1];
        static 
name[MAX_LENGTH 1], readdata[128];

        
get_user_name(indexnameMAX_LENGTH);
        
get_user_authid(indexsteamid[ACTIVE], MAX_LENGTH);

        if(
g_check[index])
        {
            new 
current    =    get_points(index);
            
current        +=    points;

            new 
fp fopen(filedir1"a+");

            if(
fp)
            {
                while(
fgets(fpreaddata127))
                {
                    
parse(readdatasteamid[PARSED], MAX_LENGTH);

                    if(
containi(steamid[PARSED], ";") != -1) continue;

                    if(
equal(steamid[ACTIVE], steamid[PARSED]))
                        
fprintf(fp"%s %d ; ^"%s^""steamid[ACTIVE], currentname); // This is executed but It's not any difference in the file.
                
}
            }

            
fclose(fp);
        }

        if(
sound && get_pcvar_num(ps_sound))
            
client_cmd(index"spk %s"g_sound_add);
    }

__________________

Last edited by atomen; 07-27-2008 at 20:43.
atomen is offline
Send a message via MSN to atomen
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-28-2008 , 04:55   Re: Data isn't written to file
Reply With Quote #2

'a+' , don't open file with that if you wan to read from the first line.

'a' = append = your pointer will always at the end of file.

Use, 'r+' .
__________________
Arkshine is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 05:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode