05.09.2013, 05:53
pawn Код:
CMD:report(playerid,params[]) {
new reported, tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /report [playerid] [reason]");
reported = strval(tmp);
O
if(IsPlayerConnected(reported) && reported != INVALID_PLAYER_ID) {
if(PlayerInfo[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) > 3) {
new reportedname[MAX_PLAYER_NAME], reporter[MAX_PLAYER_NAME], str[128], hour,minute,second; gettime(hour,minute,second);
GetPlayerName(reported, reportedname, sizeof(reportedname)); GetPlayerName(playerid, reporter, sizeof(reporter));
format(str, sizeof(str), "{00FF00}||NewReport|| %s(%d) reported %s(%d) Reason: %s |@%d:%d:%d|", reporter,playerid, reportedname, reported, params[strlen(tmp)+1], hour,minute,second);
MessageToTwice(red,str);
SaveToFile("ReportLog",str);
format(str, sizeof(str), "Report(%d:%d:%d): %s(%d) reported %s(%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;
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerAdmin(i))
{
new Float:x,Float:y,Float:z;
GetPlayerPos(i,x,y,z);
PlayerPlaySound(i,1057,x,y,z);
}
}
return SendClientMessage(playerid,yellow, "Your report has been sent to online administrators.");
} else return SendClientMessage(playerid,red,"ERROR: Must be a valid reason");
} else return SendClientMessage(playerid, red, "Player is not connected");
}