Timer Efficency
#1

Looking for a efficient way for timers. I am using this and is it more efficient or less than normal timers?

pawn Код:
public OnGameModeInit()
{
    MainTimer = SetTimer("MasterTimer", 1000, 1);
}

public MasterTimer()
{
    Second ++;
    Second2 ++;
    Second3 ++;

    if(Second == 1) // 1 Second
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                // Gate3 (Cage) U
                if(IsPlayerInRangeOfPoint(i, 5.0, -423.6993, 2201.7231, 40.9262) && OpenGateCage[i] == false) // Close --> Open
                {
                    OpenGateCage[i] = true;
                    MoveDynamicObject(Gate3, -423.692413, 2201.705811, 50.923096, 10.0);
                    MoveDynamicObject(Gate4, -423.686127, 2206.743164, 45.926369, 10.0);
                    MoveDynamicObject(Gate5, -418.655365, 2201.730713, 45.926369, 10.0);
                    MoveDynamicObject(Gate6, -423.685608, 2196.700928, 45.913692, 10.0);
                    MoveDynamicObject(Gate7, -428.733124, 2201.718506, 45.926338, 10.0);
                }
                else if(!IsPlayerInRangeOfPoint(i, 5.0, -423.699341, 2201.723145, 40.926292) && OpenGateCage[i] == true) // Open --> Close
                {
                    OpenGateCage[i] = false;
                    MoveDynamicObject(Gate3, -423.692413, 2201.705811, 59.923141, 1.5);
                    MoveDynamicObject(Gate4, -423.686127, 2215.716309, 45.926369, 1.5);
                    MoveDynamicObject(Gate5, -409.680603, 2201.730713, 45.926369, 1.5);
                    MoveDynamicObject(Gate6, -423.685608, 2187.702881, 45.913692, 1.5);
                    MoveDynamicObject(Gate7, -437.683075, 2201.718506, 45.926338, 1.5);
                }
            }
        }
        Second = 0;
    }
    if(Second2 == 180)
    {
        SendClientMessageToAll(COLOR_ORANGE, RandMessages[random(sizeof(RandMessages))]);
        Second2 = 0;
    }
    if(Second3 == 138)
    {
        DestroyDynamicObject(PirateObject2);                                                                          
        PirateObject1 = CreateDynamicObject(8493, 3751.8791503906, 1508.7846679688, 14.907380104065, 0.000000, 0.000000, 180,1,0,-1,200.0); //
        MoveDynamicObject(PirateObject1, 3752.7321777344, 1203.7044677734, 14.907380104065, 2.00 );
    }
    if(Second3 == 276)
    {
        DestroyDynamicObject(PirateObject1);
        PirateObject2 = CreateDynamicObject(8493, 3752.7321777344, 1203.7044677734, 14.907380104065, 0.000000, 0.000000, 0.000000,1,0,-1,200.0); //
        MoveDynamicObject(PirateObject2, 3751.8791503906, 1508.7846679688, 14.907380104065, 2.00);
        Second3 = 0;
    }
    return 1;
}
Reply


Messages In This Thread
Timer Efficency - by BP13 - 27.08.2010, 16:29
Re: Timer Efficency - by RoBo - 08.09.2010, 18:35
Re: Timer Efficency - by BP13 - 08.09.2010, 18:51
Re: Timer Efficency - by RoBo - 08.09.2010, 19:15
Re: Timer Efficency - by nemesis- - 08.09.2010, 19:40
Re: Timer Efficency - by Jay_ - 08.09.2010, 19:51
Re: Timer Efficency - by nemesis- - 08.09.2010, 19:53
Re: Timer Efficency - by Westie - 08.09.2010, 19:53
Re: Timer Efficency - by nemesis- - 08.09.2010, 19:56
Re: Timer Efficency - by cyber_punk - 08.09.2010, 20:07

Forum Jump:


Users browsing this thread: 2 Guest(s)