Cant get the Timer working, Plz help -.-
#2

i think there is no problem on the first code, but
Quote:
Originally Posted by jordy.kiesebrink
Посмотреть сообщение
pawn Код:
forward Checking();
public unmute(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    if(IsPlayerConnected(i) && PlayerAcc[i][Muted] == 1)
    PlayerAcc[i][Muted] = 0;
    SendClientMessage(playerid ,red,"You have been unmuted! You can talk now!");
}
What is Checking() for?
and why you need to loop it for all players since you're already using
pawn Код:
SetTimerEx("unmute", 60000, true, "i", playerid); // this will set a timer to call callback for the playerid with repeat option enabled
Quote:
Originally Posted by jordy.kiesebrink
Посмотреть сообщение
pawn Код:
public unmute(playerid)
{
    new Target;
    if(PlayerAcc[Target][Muted] == 1)
    SendClientMessage(Target,red,"You have been unmuted! You can talk now!");
    PlayerAcc[Target][Muted] = 0;
 
}
it won't make the player get unmute, because you just create a new variable "Target" with no value, try changing them to playerid
pawn Код:
public unmute(playerid)
{
    if(PlayerAcc[playerid][Muted] == 1) { // check if the player is muted
        PlayerAcc[Target][Muted] = 0; // set the player variable to 0 or not muted
        SendClientMessage(playerid, red, "You have been unmuted! You can talk now!"); // send the message to player
    }
}
also change the SetTimerEx parameter, you don't need to repeat calling the "unmute" callback
pawn Код:
SetTimerEx("unmute", 60000, false, "i", playerid); // set a timer to call "unmute" for "playerid(i)" in 60000 ms = 1 minute without repeating the timer
also make sure you have forwarded the unmute callback
Note: not tested, hope it works
for info, https://sampwiki.blast.hk/wiki/SetTimerEx
Reply


Messages In This Thread
Cant get the Timer working, Plz help -.- - by jordy.kiesebrink - 30.05.2012, 10:50
Re: Cant get the Timer working, Plz help -.- - by RoboN1X - 30.05.2012, 11:25
Re: Cant get the Timer working, Plz help -.- - by jordy.kiesebrink - 30.05.2012, 11:39

Forum Jump:


Users browsing this thread: 2 Guest(s)