SA-MP Forums Archive
debugs - 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)
+--- Thread: debugs (/showthread.php?tid=604409)



debugs - ReD_HunTeR - 04.04.2016

EDIT: Solved


Re: debugs - Crystallize - 04.04.2016

Код:
[16:06:31] [debug] #0 native fclose () from sampsvr-port_7788
I'd say it's crashing when you're using fclose somewhere in your script.


Re: debugs - ReD_HunTeR - 04.04.2016

EDIT: Solved


Re: debugs - Konstantinos - 04.04.2016

Quote:
Originally Posted by Wizzard2H
Посмотреть сообщение
I'd say it's crashing when you're using fclose somewhere in your script.
You're correct. fclose (like any other file function) crashes the server if invalid file handle (file not opened) is used.

At the moment, the only known thing you know is: OnGameModeInit -> function -> function -> fclose
so compile with debug info to get more information: https://github.com/Zeex/samp-plugin-...ith-debug-info

After done that (also update crashdetect plugin if you're not using 4.15.1), post the new logs.


Re: debugs - ReD_HunTeR - 04.04.2016

EDIT: Solved


Re: debugs - IamPuzo - 04.04.2016

Help him! I'm not experienced in fixing Debugs.


Re: debugs - Konstantinos - 04.04.2016

Change to:
pawn Код:
stock dini_Create(filename[])
{
    if (fexist(filename)) return false;
    new File: fhnd = fopen(filename, io_write);
    if (!fhnd) return false;
    return fclose(fhnd);
}
In case that cannot open the file (to create it for your case), the file handle will be 0 (invalid) hence the crash.
I'd strongly recommend you though not to use dini because it's such an outdated and slow method.


Re: debugs - ReD_HunTeR - 04.04.2016

EDIT: Solved


Re: debugs - Konstantinos - 04.04.2016

Opening the file with io_append creates the file if not exists, so no need checking if it does.
pawn Код:
stock AppendTo(filename[], string[])
{
    new File: myfile = fopen(filename, io_append);
    if (myfile)
    {
        new timestring[MAX_STRING];
        if (strcmp(filename, "phones.ini", true) == 0)
        {
            format(timestring, sizeof(timestring), "%s", string);
            fwrite(myfile, timestring);
            return fclose(myfile);
        }
        else if (strcmp(filename, "commands.log", true) == 0)
        {
            format(timestring, sizeof(timestring), "%s\n", string);
            fwrite(myfile, timestring);
            return fclose(myfile);
        }
       
        new hour, minu, seco, giorno, mese, anno;
        gettime(hour, minu, seco);
        getdate(anno, mese, giorno);
        format(timestring, sizeof(timestring), "[%d:%d:%d/%d-%d-%d]%s\n", hour, minu, seco, giorno, mese, anno, string);
        fwrite(myfile, timestring);
        return fclose(myfile);
    }
    return 0;
}



Re: debugs - ReD_HunTeR - 04.04.2016

thanks bro, it looks like that there isn't any error but the server ain't starting... and some files are failed to create