SA-MP Forums Archive
How to make player get unmuted after the timer? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to make player get unmuted after the timer? (/showthread.php?tid=420516)



How to make player get unmuted after the timer? - MiGu3X - 05.03.2013

My problem is that when player gets muted for 1 min (or more), when the minute pass he doesn't gets unmuted. this is my code

pawn Код:
CMD:mute(playerid,params[])
{
    new id, str[128], reason[50], time, timef;
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        if(sscanf(params, "uis", id, time, reason))
            return SendClientMessage(playerid, DEEPPINK, "USAGE: /mute <id> <time> <reason>");
           
        if(id == INVALID_PLAYER_ID)
            return SendClientMessage(playerid, DEEPPINK, "ERROR: Player is not connected.");
           
        if(id == playerid)
            return SendClientMessage(playerid, DEEPPINK, "ERROR: You can't mute yourself.");
           
        if(time == 0)
            return SendClientMessage(playerid, DEEPPINK, "ERROR: Time must be more than 1 minute.");
           
        timef = time * 60000;
        SetTimerEx("unmute", timef, false, "i", id);
        format(str,sizeof(str),"{FFFFFF}Admin {D81417}%s {FFFFFF}(ID: %d) has muted {D81417}%s {FFFFFF}(ID: %d) for {D81417}%i {FFFFFF}minutes | Reason: {D81417}%s", GetPlayersName(playerid), playerid, GetPlayersName(id), id, time, reason);
        SendClientMessageToAll(-1 ,str);
        muted[id] = 1;
    }
    else return SendClientMessage(playerid, DEEPPINK, "ERROR: You must be level 1 to use that command!");
    return 1;
}



Re: How to make player get unmuted after the timer? - HappyDeathmatch - 05.03.2013

timef = time * 60000;
60000 is 1 hour, or not?


Respuesta: How to make player get unmuted after the timer? - MiGu3X - 05.03.2013

60 000 milliseconds = 1 minute


Re: Respuesta: How to make player get unmuted after the timer? - HappyDeathmatch - 05.03.2013

Quote:
Originally Posted by MiGu3X
Посмотреть сообщение
60 000 milliseconds = 1 minute
Ah, okay


Re : How to make player get unmuted after the timer? - DaRk_RaiN - 05.03.2013

pawn Код:
CMD:mute(playerid,params[])
{
    new id, str[128], reason[50], time;
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        if(sscanf(params, "uis", id, time, reason))
            return SendClientMessage(playerid, DEEPPINK, "USAGE: /mute <id> <time> <reason>");

        if(id == INVALID_PLAYER_ID)
            return SendClientMessage(playerid, DEEPPINK, "ERROR: Player is not connected.");

        if(id == playerid)
            return SendClientMessage(playerid, DEEPPINK, "ERROR: You can't mute yourself.");

        if(time == 0)
            return SendClientMessage(playerid, DEEPPINK, "ERROR: Time must be more than 1 minute.");

        SetTimerEx("unmute", time*60*1000, false, "i", id);
        format(str,sizeof(str),"{FFFFFF}Admin {D81417}%s {FFFFFF}(ID: %d) has muted {D81417}%s {FFFFFF}(ID: %d) for {D81417}%i {FFFFFF}minutes | Reason: {D81417}%s", GetPlayersName(playerid), playerid, GetPlayersName(id), id, time, reason);
        SendClientMessageToAll(-1 ,str);
        muted[id] = 1;
    }
    else return SendClientMessage(playerid, DEEPPINK, "ERROR: You must be level 1 to use that command!");
    return 1;
}



Respuesta: How to make player get unmuted after the timer? - MiGu3X - 06.03.2013

Won't work, i need to like killtimer and set muted to 0 ... . please help . . .


Re: How to make player get unmuted after the timer? - Patrick - 06.03.2013

MiGu3X you dont need to kill the timer you could just use 0 or false on SetTimerEx or SetTimer so it won't repeat

and after that time you set "when it finished" you can just set the variable

pawn Код:
muted[id] = 1;
To
pawn Код:
muted[id] = 0;
Hope you understand what i mean


Respuesta: How to make player get unmuted after the timer? - MiGu3X - 07.03.2013

But how to see when timer finishes?


Re: How to make player get unmuted after the timer? - SilverKiller - 07.03.2013

In the timer just put muted[id] = 0;