25.05.2016, 15:46
So, I just realised that this code don't work really, Here's the code:
I receive Error at stock ...
at the samp server.
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);
}
}
at the samp server.