14.03.2012, 12:15
(
Последний раз редактировалось Reklez; 16.03.2012 в 05:45.
)
hello i have made /report command which report a player (hacker) and sent to online admins
it works perfect it saves to ServerFiles/Log/ now the problem is how to make /reportlist show something like this
how can i do it on dialog? here is the code.
it works perfect it saves to ServerFiles/Log/ now the problem is how to make /reportlist show something like this
Код:
[14/03/12] [15:07:01] Reklez has report Johnny | Reason: Testing
pawn Код:
new RCount = 0;
CMD:report(playerid, params[])
{
new string[128],
id,
pname[MAX_PLAYER_NAME],
name[MAX_PLAYER_NAME],
Year,
Day,
Month,
Hour,
Minute,
Second,
File:reportlog,
reason[30];
if(sscanf(params, "us[30]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /report <playerid/name> <reason>");
GetPlayerName(id, name, sizeof(name));
GetPlayerName(playerid, pname, sizeof(pname));
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid-Playerid");
if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot report yourself!");
format(string, sizeof(string), "REPORT: %s(ID:%d) "yellow"has report "white"%s(ID:%d) | "red"Reason: %s", pname, playerid, name, id, reason);
MessageToAdmins(COLOR_WHITE, string);
RCount++;
reportlog = fopen("ServerFiles/Log/reports.txt", io_append);
format(string, sizeof(string), "[%d/%d/%d] [%d:%d:%d]: %s has report %s for %s\r\n", Day, Month, Year, Hour, Minute, Second, pname, playerid, name, id, reason);
fwrite(reportlog, string);
fclose(reportlog);
format(string, sizeof(string), "You report %s(ID:%d) | Reason: %s", name, id, reason);
SendClientMessage(playerid, COLOR_RED, string);
SendClientMessage(playerid, COLOR_YELLOW, "| - Your report has been sent from Online Administrators and saved from our database as .txt!");
return 1;
}