16.03.2013, 14:35
pawn Код:
dcmd_report(playerid,params[])
{
new reported;
new tmp[256];
new tmp2[256];
new Index;
tmp = strtok(params,Index);
tmp2 = strtok(params,Index);
if(!strlen(params)) return
SendClientMessage(playerid, LIGHTBLUE2, "Usage: /report [PlayerID] [Reason]") &&
SendClientMessage(playerid, orange, "Attention: Not report anyone without Reason!");
reported = strval(tmp);
if(IsPlayerConnected(reported) && reported != INVALID_PLAYER_ID)
{
if(AccInfo[reported][Level] == ServerInfo[MaxAdminLevel])
return SendClientMessage(playerid,red,"ERROR: You cannot report this Administrator");
if(playerid == reported)
return SendClientMessage(playerid,red,"ERROR: You Cannot report Yourself");
if(strlen(params) > 7)
{
new reportedname[MAX_PLAYER_NAME], reporter[MAX_PLAYER_NAME], str[128];
new hour,minute,second;
gettime(hour,minute,second);
GetPlayerName(reported, reportedname, sizeof(reportedname));
GetPlayerName(playerid, reporter, sizeof(reporter));
format(str, sizeof(str), "REPORT: %s(Id:%d) Reported %s(Id:%d) Reason: %s |Time: %d:%d:%d|", reporter,playerid, reportedname, reported, params[strlen(tmp)+1], hour,minute,second);
MessageToAdmins(COLOR_WHITE,str);
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;
return SendClientMessage(playerid,yellow, "|- Your report has been sent to Online Administrators and saved in File! -|");
}
else return SendClientMessage(playerid,red,"ERROR: Invalid Reason!");
}
else return ErrorMessages(playerid, 2);
}