when saving to a file, it rewrites the old line...
#1

hey everyone,

i made this /report cmd, but the cmd save it in a log, and rewrite the oldline..., so like if i report id 0 as reason i hate you, then it saves it as Player Report = name(id 0) Reason: i hate you.

that works fine, but when i warn someone else AFTER i warned id 0, it removes the previous report, and writes a new one..

pawn Код:
CMD:report(playerid, params[])
{
    new targetid, message[128], string[300], tname[MAX_PLAYER_NAME];
    if(sscanf(params, "us[128]", targetid, message)) return SendClientMessage(playerid, COLOR_YELLOW, "Correct Usage: /report [playerid] [reason]");
    if(targetid != INVALID_PLAYER_ID)
    {
        GetPlayerName(targetid, tname, sizeof(tname));
        foreach(Player, i)
        {
            if(PlayerInfo[i][AdminLevel] >= 1)
            {
                format(string, sizeof(string), "Player Report: {FF0000}%s(ID: {00FF00}%d) {FFFFFF}Reason: {FF0000}%s", tname, targetid, message);
                GameTextForPlayer(i, "Player Report!", 5000, 5);
                SendClientMessage(i, BANNEDMESSAGE, string);
                PlayerPlaySound(i, 1138, 0, 0, 0);
            }
        }
        new file[300];
        format(file,sizeof(file),"nAdmin/Logs/ReportLog.ini");
        if(!fexist(file))
        {
            dini_Create(file);
        }
        format(string, sizeof(string), "%s(ID: %d) Reason: %s", tname, targetid, message);
        dini_Set(file, "Player Report", string);
        GameTextForPlayer(playerid, "Report Send!", 3000, 5);
        PlayerPlaySound(playerid, 1138, 0, 0, 0);
        format(string, sizeof(string), "you have reported %s(ID:%s) Reason: %s", tname, targetid, message);
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    else return SendClientMessage(playerid, COLOR_RED, "ERROR: that player isn't online");
    return 1;
}
greets niels
Reply
#2

erhm i dont understand you... could you explain it different way?

and how should i do it then?
Reply
#3

should i do .txt then? idk, i thought it would work, didnt really think about that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)