Logs help
#1

Hello I was wondering if anyone can help me out,I need my server to write logs of the admin commands which have been used by the players for example:
Nick has used /get on Travis
if anyone can provide a tutorial that would help alot
Reply
#2

Код:
new File:acmds; // Add this at the top of your script under includes so you don't have to put it everytime in every command.
Код:
CMD:get(playerid, params[])
{
    new pID, log[128], year, month, day, hour, minute, second,  Float:X, Float:Y, Float:Z;
    getdate(year, month, day);
    gettime(hour, minute, second);
    if(PlayerInfo[playerid][pAdmin] < 1 || PlayerInfo[playerid][pAdmin] > 4) return SendClientMessage(playerid, grey, "Error: You are not authorized to use this command.");
    if(sscanf(params,"i", pID)) return SendClientMessage(playerid, grey,"[Usage] /get [id]");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, grey,"Error: Player not found!");
    GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
    SetPlayerPos(pID, Float:X + 3.0 ,Float:Y,Float:Z);
    format(log, sizeof(log),"[%02d/%02d/%04d %02d:%02d:%02d] [Admin] %s has used /get on %s.\r\n",day, month, year, hour, minute, second, GetName(playerid), GetName(pID));
    acmds = fopen("acmds.log", io_append);
    fwrite(acmds, log);
    fclose(acmds);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)