CMD:report(playerid) { if(!isnull(text)) { new string[128]; format(string, sizeof(string), "Report from %s: %s", PlayerNameEx(playerid), text); ABroadCast(COLOR_YELLOW,string,1); #if Report-Log new File:Reports; new day, month, year, minute, second, hour; gettime(hour,minute,second); getdate(year, month, day); Reports = fopen("logs/Reports.txt",io_append); format(string,sizeof(string),"[%02d/%02d/%02d %02d:%02d:%02d] Report from %s: %s\r\n",day, month, year,hour, minute, second,PlayerName(playerid),text); fwrite(Reports,string); fclose(Reports); print(string); #endif SendClientMessage(playerid, COLOR_YELLOW, "Your report was sent to the admin team:"); SendClientMessage(playerid, COLOR_YELLOW, text); PlayerMuteInfo[playerid][ReportCool] = 20; } else { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Report [Text]"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Please be specific in your report!"); } return 1; }
I'd like to think it explains itself really. Below is an example, well more like an already drawn out cmd for you. But this should more or less do the job
Код HTML:
CMD:report(playerid) { if(!isnull(text)) { new string[128]; format(string, sizeof(string), "Report from %s: %s", PlayerNameEx(playerid), text); ABroadCast(COLOR_YELLOW,string,1); #if Report-Log new File:Reports; new day, month, year, minute, second, hour; gettime(hour,minute,second); getdate(year, month, day); Reports = fopen("logs/Reports.txt",io_append); format(string,sizeof(string),"[%02d/%02d/%02d %02d:%02d:%02d] Report from %s: %s\r\n",day, month, year,hour, minute, second,PlayerName(playerid),text); fwrite(Reports,string); fclose(Reports); print(string); #endif SendClientMessage(playerid, COLOR_YELLOW, "Your report was sent to the admin team:"); SendClientMessage(playerid, COLOR_YELLOW, text); PlayerMuteInfo[playerid][ReportCool] = 20; } else { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Report [Text]"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "Please be specific in your report!"); } return 1; } |
CMD:report(playerid, params[])
{
new sstring[256], giveplayerid, reason[128], playername[25], giveplayer[25], string[128];
if (sscanf(params, "us[128]", giveplayerid, reason)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /report [playerid] [reason]");
if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, 0xFF000000, "Error: Inactive player id!");
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
format(sstring, sizeof(sstring), "%s reported player %s (Id%d) - %s.\r\n", playername, giveplayer, giveplayerid, reason);
SendMessageToAdmins(0xFFFFFFFF, sstring);
format(string, 128, "Your report regarding %s has been sent to server admins.", giveplayer);
SendClientMessage(playerid, 0xFFFFFFFF, string);
GameTextForPlayer(playerid, "~b~~h~~h~Report sent", 5000, 3);
printf("[report] %s has reported player %s (Id%d) - %s.", playername, giveplayer, giveplayerid, reason);
new File: file = fopen("reports.cfg", io_append);
fwrite(file, sstring);
fclose(file);
return 1;
}
CMD:reports(playerid, params[])
{
if (!IsPlayerAdmin(playerid)) return 0; //You can change the admin system which you got.
new strings[128], File: file = fopen("reports.cfg", io_read), idxx=1;
SendClientMessage(playerid, 0xFFFFFFF, "[Reports]:");
while(fread(file, strings))
{
format(strings, sizeof(strings), "%d) %s", idxx, strings);
SendClientMessage(playerid, 0xFFFFFFF, strings);
idxx ++;
}
fclose(file);
return 1;
}
SendMessageToAdmins(color, message[])
{
for (new i = 0; i < PLAYERS; i++)
{
if (IsPlayerConnected(i) && IsPlayerAdmin(i)) SendClientMessage2(i, color, message); //You can change the admin system which you got.
}
}