each player has a separate log backup
#2

pawn Код:
forward OnPlayerCommandPerformed(playerid, cmdtext[], success);
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(success)
    {
        new playerfile[24],string[64];
        format(playerfile,sizeof(playerfile),"Logs/%s.txt",GetPlayerNameEx(playerid));
        format(string,sizeof(string),"[COMMAND] - /%s\r\n",cmdtext);
        new File:ftw=fopen(playerfile, io_append);
        if(ftw)
        {
            fwrite(ftw, string);
        }
        fclose(ftw);
    }
    return 1;
}
stock GetPlayerNameEx(playerid)
{
     new pName[25];
     GetPlayerName(playerid, pName, sizeof(pName));
     return pName;
}
That's outdated way, you should use something like y_ini for file functions would be better i just wanted to give you the basic idea.

Source: https://sampwiki.blast.hk/wiki/Fopen

EDIT: https://sampforum.blast.hk/showthread.php?tid=244223 - that's y_ini tutorial if you're interested to make a better and a faster version of this code.
Reply


Messages In This Thread
each player has a separate log backup - by Slicebook - 18.09.2014, 14:14
Re: each player has a separate log backup - by SilentSoul - 18.09.2014, 15:14
Re: each player has a separate log backup - by Stinged - 18.09.2014, 16:06
Re: each player has a separate log backup - by Slicebook - 18.09.2014, 18:38

Forum Jump:


Users browsing this thread: 1 Guest(s)