Trying to write /reports to file
#1

Listed as a command:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(parch, 5, cmdtext);
	dcmd(jetpack, 7, cmdtext);
	dcmd(report, 6, cmdtext);
	dcmd(randomcolor, 11, cmdtext);
	dcmd(stats, 5, cmdtext);
	dcmd(commands, 8, cmdtext);
	return 1;
}
Command:
Код:
dcmd_report(playerid, params[])
{

	new tmp[256], idx;
	tmp = strtok(params, idx);
	if(!strlen(tmp)){
	    SendClientMessage(playerid, 0x555252AA, "/report [id] [reason]");
	    return 1;
	}else{
	    new pid = strval(tmp);
		tmp = strrest(params, idx);
		if(!IsPlayerConnected(pid)){
		    SendClientMessage(playerid, 0x555252AA, "Invalid Player");
		    return 1;
		}else{
		    if(!strlen(tmp)){
		        SendClientMessage(playerid, 0x555252AA, "/report [id] [reason]");
		        return 1;
			}else{
			    new name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], string[200];
			    GetPlayerName(playerid, name, sizeof(name));
			    GetPlayerName(pid, name2, sizeof(name2));
			    format(string, sizeof(string), "*%s(%d) reported %s(%d) for '%s'", name, playerid, name2, pid, tmp);
				for(new i=0; i<GetMaxPlayers(); i++){
				    if(IsPlayerConnected(i)){
				        if(IsPlayerAdmin(i)){
				            SendClientMessage(i, 0x555252AA, string);
						}
					}
				}
			}
		}
	}
	return 1;
}
And at the bottom of script:
Код:
stock WriteReportsLog(string[])
{

    if(!fexist("Reports.log")) dini_Create("Reports.log"); // You need to change dini_Create to your file creating system. new

        entry[255], File: hFile;

    format(entry, sizeof(entry), "%s\r\n", string); hFile = fopen("Reports.log", io_append); fwrite(hFile, entry); fclose(hFile);

}
If I delete the stock WriteReportsLog(string[]) then it will say the player has been reported but when i check there is no file for reports.

if I keep that code then when I /report id reason nothing happens.
Reply


Messages In This Thread
Trying to write /reports to file - by Brandondw8 - 14.05.2014, 19:53
Re: Trying to write /reports to file - by KillerStrike23 - 14.05.2014, 19:58
Re: Trying to write /reports to file - by Brandondw8 - 14.05.2014, 20:03
Re: Trying to write /reports to file - by Brandondw8 - 14.05.2014, 20:07
Re: Trying to write /reports to file - by awsomedude - 14.05.2014, 21:00
Re: Trying to write /reports to file - by Brandondw8 - 14.05.2014, 23:28
Re: Trying to write /reports to file - by Brandondw8 - 15.05.2014, 00:32
Re: Trying to write /reports to file - by KillerStrike23 - 15.05.2014, 03:47
Re: Trying to write /reports to file - by Brandondw8 - 15.05.2014, 04:42
Re: Trying to write /reports to file - by Brandondw8 - 15.05.2014, 07:45

Forum Jump:


Users browsing this thread: 1 Guest(s)