07.06.2015, 08:04
pawn Код:
CMD:mute(playerid,params[])
{
if(pInfo[playerid][Admin]>=3)
{
new plid,minutes,reason[64];
if(sscanf(params,"uis[64]",plid,minutes,reason)) return SCM(playerid,COLOR_GREY,"INFO: /mute [playerid][minutes][reason]");
if(!IsPlayerConnected(plid)) return SCM(playerid,COLOR_GREY,"No such player");
if(minutes<1 || minutes>99999) return SCM(playerid,COLOR_GREY,"You can't mute a player for more than 99999 minutes!");
new adminname[MAX_PLAYER_NAME],playername[MAX_PLAYER_NAME],string[256];
GetPlayerName(playerid,adminname,sizeof(adminname));
GetPlayerName(plid,playername,sizeof(playername));
format(string,sizeof(string),"[ADMIN] {%06x}%s {FF6347}was muted by {%06x}%s {FF6347}for %d minutes, reason: {33CCFF}%s",GetPlayerColor(plid)>>>8,playername,GetPlayerColor(playerid)>>>8,adminname,minutes,reason);
SendClientMessageToAll(COLOR_LIGHTRED,string);
new mtm=minutes*60;
pInfo[plid][MuteSeconds]=mtm;
}
else return SCM(playerid,COLOR_LIGHTRED,"You are not allowed to use this command!");
return 1;
}
pawn Код:
SetTimer("Timer_ProcessMutes",1000,true);
pawn Код:
forward Timer_ProcessMutes();
pawn Код:
public Timer_ProcessMutes()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(Logged[i]==1)
{
if(pInfo[i][MuteSeconds]!=0)
{
pInfo[i][MuteSeconds]--;
}
}
}
}
}
Also, sorry for the indentation, I can't really fix it on the forum. Make sure to fix it when putting it in your GM