Adding stuff to another file.
#1

How would I add something to Scriptfiles/Logs/ban.log ? I know it'd be something like /Logs/ban.log but how would I add it to
Код:
CMD:ban(playerid, params[])
{
    new
        string[128],
        giveplayerid,
        adminname[MAX_PLAYER_NAME],
        playername[MAX_PLAYER_NAME],
        reason[50];
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COL_GREY, "You are not authorized for that command!");
    else if(sscanf(params, "rs[50]", giveplayerid, reason)) return SendClientMessage(playerid, COL_GREY, "Usage: /ban [ID/PartOfName] [Reason]");
    else if(!IsPlayerConnected(giveplayerid) || giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COL_GREY, "Invalid playerid!");
    else {
        format(string, sizeof(string), "SERVER: %s have been banned by %s, reason: %s.", playername, adminname, reason);
        SendClientMessageToAll(0xF81414FF, string);
        Kick(giveplayerid);
    }
    return 1;
}
so that when you get /ban'ned it adds it to ban.log?
Reply
#2

https://sampwiki.blast.hk/wiki/Fwrite
Reply
#3

PHP код:
    new File:File,msg[128];
    
format(msg,128,">> %s have been banned by %s, reason: %s.\r\n"playernameadminnamereason);
    
File fopen("Logs/ban.txt",io_append);
    
fwrite(File,msg);
    
fclose(File); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)