Saving text
#1

Hello!
It is possible to save a text in a file.txt?

Like when I type /report to save the "reports" in a file,and I will check all of them.

Код:
CMD:report(playerid, params[])
{
    new rstring[128];
    if(!isnull(params))
    {
        SendClientMessage(playerid, COLOR_RED1, "Your report was sent to the Admins.");
        format(rstring, sizeof(rstring), "Report sent to Admins: "BLUESV"%s", params); // Proof to the reporter, that the command worked.
        SendClientMessage(playerid, COLOR_RED1, rstring);
        for(new i=0; i<MAX_PLAYERS; i++)
        {
       		if ( GetPVarInt( playerid, "AdminLevel" ) < 1)
	   			return SendClientMessage( playerid, -1, "You are not allowed to use this command!");
            {
                format(rstring, sizeof(rstring), "Report from "BLUESV"%s - [%d]"BLUESV": %s", pName(playerid), playerid, params);
                SendClientMessage(i, REDS, rstring); // Send's the format to the online Rcon'ly Logged in Admins.
            }
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "Usage: /Report [text]"); // Show's the player the Usage.
    }
    return 1;
}
Reply
#2

Quote:
Originally Posted by SumX
Посмотреть сообщение
Hello!
It is possible to save a text in a file.txt?

Like when I type /report to save the "reports" in a file,and I will check all of them.

Код:
CMD:report(playerid, params[])
{
    new rstring[128];
    if(!isnull(params))
    {
        SendClientMessage(playerid, COLOR_RED1, "Your report was sent to the Admins.");
        format(rstring, sizeof(rstring), "Report sent to Admins: "BLUESV"%s", params); // Proof to the reporter, that the command worked.
        SendClientMessage(playerid, COLOR_RED1, rstring);
        for(new i=0; i<MAX_PLAYERS; i++)
        {
       		if ( GetPVarInt( playerid, "AdminLevel" ) < 1)
	   			return SendClientMessage( playerid, -1, "You are not allowed to use this command!");
            {
                format(rstring, sizeof(rstring), "Report from "BLUESV"%s - [%d]"BLUESV": %s", pName(playerid), playerid, params);
                SendClientMessage(i, REDS, rstring); // Send's the format to the online Rcon'ly Logged in Admins.
            }
        }
    }
    else
    {
        SendClientMessage(playerid, -1, "Usage: /Report [text]"); // Show's the player the Usage.
    }
    return 1;
}
Add this

Код:
new reportedname[MAX_PLAYER_NAME], reporter[MAX_PLAYER_NAME], str[128];
new hour,minute,second;
gettime(hour,minute,second);			
SaveIn("ReportLog",str);
format(str, sizeof(str), "(%d:%d:%d): %s(ID:%d) Reported %s(ID:%d) Reason: %s",                   
hour,minute,second, reporter,playerid, reportedname, reported, params[strlen(tmp)+1]);
for(new i = 1; i < MAX_REPORTS-1; i++) Reports[i] = Reports[i+1];
Reports[MAX_REPORTS-1] = str;
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)