Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Checking time left in settimerex.

Initiate Mage
Joined
Jul 22, 2014
Messages
3
Reaction score
0
Hey guys so i try to check when someone in mute how much time he have to be unmuted
so this is what i done :
PHP Code:
new TimeUnMute[MAX_PLAYERS];

TimeUnMute[playerid] = SetTimerEx("MuteEnd", 30000, false, "dd", playerid);

if(
InMute[playerid] == 1) return SendFormatMessage(playerid, red, "You can talk more %d seconds",TimeUnMute[playerid]),0;


And its dosent work, why?
 
Super-Moderator
Staff member
Super-Moderator
Joined
Apr 28, 2007
Messages
1,501
Reaction score
757
You'll have to run the mute timer every second, and decrease the variable by one everytime the timer has been called.
Code:
new Muted[MAX_PLAYERS],
    MutedLeft[MAX_PLAYERS];


forward MutedPlayer(playerid);


MutedLeft[playerid] = 30; // 30 seconds. 


Muted[playerid] = SetTimerEx("MutedPlayer", 1000, true, "i", playerid);


public MutedPlayer(playerid)
{
    if(MutedLeft[playerid] == 1)
    {
        KillTimer(Muted[playerid]);
    }
    MutedLeft[playerid]--;
}




//MutedLeft[playerid] will now return the amount of seconds left when muted
 
Back
Top