Server Chatlogging Help
#1

This crashes my server. This was taken from this: https://sampforum.blast.hk/showthread.php?tid=264770

The reason I didn't reply to that thread was because it would be bumping and I think it would perhaps be better to make a new thread - sorry if it was the wrong decision.

The code used:

pawn Код:
public OnPlayerText(playerid, text[])
{
    ChatLog(playerid, text);
    return 1;
}


stock ChatLog(playerid, text[])
{
    new
     File:lFile = fopen("Logs/Chat.txt", io_append),
     logData[178],
        fyear, fmonth, fday,
        fhour, fminute, fsecond;

    getdate(fyear, fmonth, fday);
    gettime(fhour, fminute, fsecond);

    format(logData, sizeof(logData),"[%02d/%02d/%04d %02d:%02d:%02d] %s: %s \r\n", fday, fmonth, fyear, fhour, fminute, fsecond, GetName(playerid), text);
    fwrite(lFile, logData);

    fclose(lFile);
    return 1;
}

stock GetName(playerid)
{
    new
     pName[MAX_PLAYER_NAME];

    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    return pName;
}
Is there a reason this would crash my server? I tried both return 1 and return 0 for the OnPlayerText.

Thanks.
Reply


Messages In This Thread
Server Chatlogging Help - by PrivatioBoni - 04.02.2014, 18:06
Re: Server Chatlogging Help - by Konstantinos - 04.02.2014, 18:09
Re: Server Chatlogging Help - by PrivatioBoni - 04.02.2014, 18:17
Re: Server Chatlogging Help - by Konstantinos - 04.02.2014, 18:20
Re: Server Chatlogging Help - by PrivatioBoni - 04.02.2014, 18:26

Forum Jump:


Users browsing this thread: 1 Guest(s)