debugs
#1

EDIT: Solved
Reply
#2

Код:
[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.
Reply
#3

EDIT: Solved
Reply
#4

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.
Reply
#5

EDIT: Solved
Reply
#6

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

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.
Reply
#8

EDIT: Solved
Reply
#9

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;
}
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)