AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Data isn't written to file (https://forums.alliedmods.net/showthread.php?t=74955)

atomen 07-27-2008 20:28

Data isn't written to file
 
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);
    }



Arkshine 07-28-2008 04:55

Re: Data isn't written to file
 
'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+' .


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

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