[pwn]if(strcmp(cmd, "/mute", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, " Подсказка: /mute [ID игрока] [минуты] [причина]");
return 1;
}
new playa;
new vremya;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
vremya = strvalEx(tmp);
if (PlayerInfo[playerid][pAdmin] >= 2)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{ if(vremya == 0)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Ты разоткнул %s", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
PlayerInfo[playa][pMuteTime] = 0;
format(string, sizeof(string), " Админ %s разоткнул тебя",sendername);
SendClientMessage(playa, COLOR_LIGHTBLUE, string);
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, " Подсказка: /mute [ID игрока] [минуты] [причина]");
return 1;
}
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* Ты заткнул %s на %d минут", giveplayer,vremya);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
PlayerInfo[playa][pMuteTime] = vremya*60;
format(string,sizeof(string)," Администратор %s заткнул игрока %s на %d минут, Причина: %s",sendername,giveplayer,vremya,result);
AdmCmdLog(string);
SendClientMessageToAll(COLOR_LIGHTRED,string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Ты не можешь использовать эту команду!");
}
}
return 1;
}[/pwn]
в enum pinfo
[pwn]pMuteTime,[/pwn]
в setplayerunjail
[pwn]if(PlayerInfo[i][pMuteTime] > 0)
{
PlayerInfo[i][pMuteTime] -=1;
}[/pwn]
в onplayerregister
[pwn]format(var, 64, "MuteTime=%d\n",PlayerInfo[playerid][pMuteTime]);fwrite(hFile, var);[/pwn]
в onplayerupdate
[pwn]format(var, 64, "MuteTime=%d\n",PlayerInfo[playerid][pMuteTime]);fwrite(hFile, var);[/pwn]
в onplayerlogin
[pwn]PlayerInfo[playerid][pMuteTime]=0;[/pwn]
и в команды
[pwn]if(PlayerInfo[playerid][pMuteTime] > 0)
{
format(string,sizeof(string)," Ты заткнут админом, ты не можешь говорить еще %d секунд!", PlayerInfo[playerid][pMuteTime]);
SendClientMessage(playerid, COLOR_GREY,string);
return 1;
}[/pwn]