PHP код:
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;
}
/Reports command:
PHP код:
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;
}
stock of sending message to admins:
PHP код:
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.
}
}