[HELP] Saving Messages
#2

pawn Код:
public OnPlayerText(playerid, text[])
{
    new PlayerLog[60], Name[MAX_PLAYER_NAME];
    format(PlayerLog, sizeof(PlayerLog), "logs/%s.txt", GetPlayerName(playerid, Name, sizeof(Name));
    new File:playerslog = fopen(PlayerLog, io_append), string[256];
    format(string, sizeof(string), "%s says: %s", GetPlayerName(playerid, Name, sizeof(Name), text);
    fwrite(playerslog, string);
    fclose(playerslog);
    return 1;
}
Very basic, simply creates a file if it doesn't exist, and when the person uses regular chat (not commands) he creates a log with the text he has in it. The name of the file is his name. I'm not even sure if this will work, I simply took this from another script and changed it to my liking.

If you want to make it so when someone uses a command, it adds that to the file, simply tell me and I can create a function that will do the above but also show what command was done.
Reply


Messages In This Thread
[HELP] Saving Messages - by Saw® - 17.06.2012, 13:52
Re: [HELP] Saving Messages - by Kindred - 17.06.2012, 14:13
Re: [HELP] Saving Messages - by Saw® - 18.06.2012, 10:33
Re: [HELP] Saving Messages - by Saw® - 18.06.2012, 17:50
Re: [HELP] Saving Messages - by MadeMan - 18.06.2012, 18:06
Re: [HELP] Saving Messages - by MarinacMrcina - 18.06.2012, 18:11
Re: [HELP] Saving Messages - by MadeMan - 18.06.2012, 18:12
Re: [HELP] Saving Messages - by MarinacMrcina - 18.06.2012, 18:14
Re: [HELP] Saving Messages - by MadeMan - 18.06.2012, 18:21
Re: [HELP] Saving Messages - by Saw® - 19.06.2012, 09:03

Forum Jump:


Users browsing this thread: 2 Guest(s)