/mute Command [ZCMD]
#2

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;
}
This under OnGameModeInit:
pawn Код:
SetTimer("Timer_ProcessMutes",1000,true);
This somewhere at the beginning of the script:
pawn Код:
forward Timer_ProcessMutes();
And this anywhere in the script (just not inside a callback):
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]--;
                }
            }
        }
    }
}
You'll need to change & add some variables in your script like pInfo[i][MuteSeconds] or pInfo[playerid][Admin].
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
Reply


Messages In This Thread
/mute Command [ZCMD] - by ChristolisTV - 07.06.2015, 07:56
Re: /mute Command [ZCMD] - by Vlad64 - 07.06.2015, 08:04
Re: /mute Command [ZCMD] - by ChristolisTV - 07.06.2015, 08:28
Re: /mute Command [ZCMD] - by Vlad64 - 07.06.2015, 10:40
Re: /mute Command [ZCMD] - by ChristolisTV - 07.06.2015, 17:23

Forum Jump:


Users browsing this thread: 1 Guest(s)