В OnPlayerCommandText:
Code: Select all
else if(strcmp(cmd, "/mute", true) == 0)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Введите: /mute [id] [минуты]");
if (dostup[playerid] != 1) return ShowPlayerDialog(playerid,2934,DIALOG_STYLE_INPUT,"Доступ администратора","Введите свой key в окошко и нажмите 'Ок'","Ок","Отмена");
new playa;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(!strlen(tmp))
{
if(PlayerInfo[playa][pMuted] == 1)
{
PlayerInfo[playa][pMuted] = 0;
PlayerInfo[playa][pMuteTime] = 0;
printf("%s ????? ????????",giveplayer);
format(string, sizeof(string), "Администратор %s снял бан чата у %s ",sendername, giveplayer);
SendClientMessageToAll(COLOR_LIGHTRED, string);
}
return 1;
}
new mins = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(PlayerInfo[playa][pMuted] == 0)
{
PlayerInfo[playa][pMuteTime] = mins*60;
PlayerInfo[playa][pMuted] = 1;
printf("%s ??????? %s",sendername, giveplayer);
format(string, sizeof(string), "%s получил бан чата от администратора %s ",giveplayer, sendername );
SendClientMessageToAll(COLOR_LIGHTRED, string);
}
else
{
PlayerInfo[playa][pMuted] = 0;
PlayerInfo[playa][pMuteTime] = 0;
printf("%s ????? ????????",giveplayer);
format(string, sizeof(string), "Администратор %s снял бан чата у %s ",sendername, giveplayer);
SendClientMessageToAll(COLOR_LIGHTRED, string);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Вы не уполномочены использовать эту команду!");
}
}
return 1;
}