Timer help
#1

I really need a timer for the /mute command and I got no idea...
The command
pawn Код:
if(strcmp(cmd, "/mute", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GREY, "USAGE: /mute [playerid/PartOfName]");
                return 1;
            }
            new playa;
            playa = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        if(PlayerInfo[playa][pMuted] == 0)
                        {
                            PlayerInfo[playa][pMuted] = 1;
                            printf("AdmCmd: %s silenced %s",sendername,  giveplayer);
                            format(string, sizeof(string), "I have given to %s /mute", giveplayer);
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            format(string, sizeof(string), "You got /mute from %s", sendername);
                            SendClientMessage(playa, COLOR_LIGHTBLUE, string);
                            format(string, sizeof(string), "AdmCmd: %s a primit Mute de la %s", giveplayer, sendername);
                            ABroadCast(COLOR_RED,string,1);
                        }
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command !");
            }
        }
        return 1;
    }
Reply
#2

Do you want the timer to execute after the command? To like unmute a player or something?
Reply
#3

pawn Код:
//Inside ur command
SetTimerEx("Unmute",30*1000,false,"i",playa);
//

//in publics
forward Unmute(playerid);
public Unmute(playerid)
{
 PlayerInfo[playerid][pMuted] = 0;
 return 1;
}
Reply
#4

I mean like /mute [ID] [TIME]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)