Timer Bug?
#2

Are you using any plugin or include related to timers? Are you running any code often which takes a lot of time to be executed? What OS are you running your server on?


Your code seems okay, I've tried to improve it a little bit tho. Feel free to take a look:
PHP код:
Start_Map[DM] = SetTimerEx("StartMap"1000true"d"DM);
forward StartMap(mode); 
public 
StartMap(mode

    
/*
        Two cells are okay for this array since the countdown
        displays just a character + EOS (for example 3 + \0).
        The EOS (\0) is used to close the string, and it takes one cell.
    */
    
new string[2];
    switch(
mode
    { 
        case 
DM
        { 
            
Countdown[DM]--;
            for(new 
0GetPlayerPoolSize(); <= ti++) 
            {
                
/*
                    This code skips the ID if the player is not
                    connected or if his pMode is not set to DM.
                */
                
if(!IsPlayerConnected(i) || pMode[i] != DM)
                {
                    continue;
                } 
                
/*
                    The code below is executed for connected
                    players who have pMode set to DM.
                */
                
if(Countdown[DM] > 0
                { 
                    
format(stringsizeof(string), "%d"Countdown[DM]);
                    
GameTextForPlayer(istring10004); 
                } 
                else 
                { 
                    
KillTimer(Vehicle_Freeze[DM]); 
                    
KillTimer(Start_Map[DM]); 
                      
Countdown[DM] = 4;
                    
GameTextForPlayer(i"Go!"10004); 
                    
TogglePlayerControllable(itrue); 
                }             
            } 
        } 
    } 
    return 
1

Reply


Messages In This Thread
Timer Bug? - by NoteND - 07.03.2019, 18:58
Re: Timer Bug? - by RIDE2DAY - 08.03.2019, 00:46
Re: Timer Bug? - by Jefff - 08.03.2019, 01:17
Re: Timer Bug? - by NoteND - 08.03.2019, 06:53

Forum Jump:


Users browsing this thread: 1 Guest(s)