stock WriteLog(file[], text[])
#1

So, I just realised that this code don't work really, Here's the code:
pawn Код:
//****||** Log Writing **||****//
stock WriteLog(file[], input[])
{
    new fileText[126];
    format(fileText, 126, "%s.txt", file);

    new File:handle = fopen(fileText, io_append);

    if(handle)
    {
        new H, M, S,
            inputText[126];

        gettime(H, M, S);

        format(inputText, 126, "[%02d:%02d:%02d] %s\r\n", H, M, S, input);
        fwrite(handle, inputText);
        fclose(handle);
    }
    else
    {
        new printText[126];
        format(printText, 126, "Could not append to file %s", file);

        print("Error at stock WriteLog(file[], input[])");
        print(printText);
    }
}

stock WritePlayerLog(playerid, input[])
{
    new fileText[126],
        name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(fileText, 126, "log/%s.txt", name);

    new File:handle = fopen(fileText, io_append);

    if(handle)
    {
        new H, M, S,
            inputText[126];

        gettime(H, M, S);

        format(inputText, 126, "[%02d:%02d:%02d] %s\r\n", H, M, S, input);
        fwrite(handle, inputText);
        fclose(handle);
    }
    else
    {
        new printText[126];
        format(printText, 126, "Could not append to file %s", name);

        print("Error at stock WritePlayerLog(file[], input[])");
        print(printText);
    }
}
I receive Error at stock ...
at the samp server.
Reply


Messages In This Thread
stock WriteLog(file[], text[]) - by Luicy. - 25.05.2016, 15:46
Re: stock WriteLog(file[], text[]) - by Stinged - 25.05.2016, 16:13
Re: stock WriteLog(file[], text[]) - by Luicy. - 25.05.2016, 16:40
Re: stock WriteLog(file[], text[]) - by Stinged - 25.05.2016, 17:06
Re: stock WriteLog(file[], text[]) - by Konstantinos - 25.05.2016, 17:23
Re: stock WriteLog(file[], text[]) - by Luicy. - 25.05.2016, 18:02
Re: stock WriteLog(file[], text[]) - by Stinged - 25.05.2016, 18:05
Re: stock WriteLog(file[], text[]) - by Luicy. - 25.05.2016, 18:20
Re: stock WriteLog(file[], text[]) - by Stinged - 25.05.2016, 18:28

Forum Jump:


Users browsing this thread: 1 Guest(s)