12.01.2015, 15:59
pawn Код:
// ============ MUTE COMMAND ===================== //
CMD:mute(playerid, params[])
{
new targetid, minutes, reason[128], string[128];
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected to the server");
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_RED, "Command not found on server! /help");
if(sscanf(params,"uis[128]", targetid, minutes, reason)) return SendClientMessage(playerid, COLOR_RED, "Mute: /mute (id) (minutes) (reason)");
format(string, sizeof(string), "Administrator %s muted %s for %d minutes: %s", PlayerName(playerid), PlayerName(targetid), minutes, reason);
SendClientMessageToAll(COLOR_RED, string);
mutetimer = SetTimerEx("Unmute", minutes*60000, false, "i", playerid);
PlayerInfo[playerid][Muted] == 1;
new INI:File = INI_Open(UserPath(targetid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Muted",1);
INI_Close(File);
return 1;
}
public Unmute(targetid)
{
new targetid;
PlayerInfo[targetid][Muted] == 0;
new INI:File = INI_Open(UserPath(targetid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Muted",0);
INI_Close(File);
SendClientMessage(targetid, COLOR_RED, "You have been unmuted automatically by server");
return 1;
}
forward Unmute(targetid);
public OnPlayerText(playerid, text[])
{
new string[128];
if(PlayerInfo[playerid][Muted] == 1)
{
SendClientMessage(playerid,COLOR_RED,"You are muted, you are not allowed to talk!");
return 0;
}
format(string,sizeof(string),"{%06x}%s (%d): {FFFFFF}%s",GetPlayerColor(playerid), PlayerName(playerid), playerid, text);
SendClientMessageToAll(-1, string);
return 0;
}