24.10.2016, 10:08
PHP код:
CMD:report(playerid,params[])
{
new Target,reason[50],rstring[128];
if(IsJailedOrMuted(playerid))return 1;
if(sscanf(params,"us[50]",Target,reason))return SendClientMessage(playerid,GREY,"USAGE: /report [playerid] [reason]");
if(!IsPlayerConnectedEx(Target)) return SendClientMessage(playerid,GREY,"Invalid player ID");
if(strlen(reason) > 50) return SendClientMessage(playerid,GREY,"Reason can't be longer than 50 characters");
format(rstring,sizeof(rstring),"SERVER: {FFFFFF}%s reported %s(Reason: %s)\r\n",PlayerName(playerid),PlayerName(Target),reason);
SendMessageToAdmins(RED,rstring);
SendClientMessage(playerid,YELLOW,"Your report has been sucessfully sent to the online admins");
new File: file = fopen("report_log.txt", io_append);
fwrite(file, rstring);
fclose(file);
return 1;
}
CMD:reports(playerid, params[])
{
if (adlvl[playerid] < 1) return 0;
new string[256];
new strings[128], File: file = fopen("report_log.txt", io_read), idxx=1;
SendClientMessage(playerid, COLOR_ORANGE, "[Server Reports]:");
while(fread(file, strings))
{
format(strings, sizeof(strings), "%d) %s", idxx, strings);
SendClientMessage(playerid, COLOR_ORANGE, strings);
AddAdminCmdLog(playerid, string);
idxx ++;
}
fclose(file);
return 1;
}