The fading effect from timer at first use is laggy?
#1

Hello, I have timer that will fade textdraws in, it's working fine, but I have issue, that when I restart server, first fade in is laggy. When I fade in again, it's working just fine.

pawn Код:
//Inside of my debug command:
gs_MaintenanceFadeInTimer = SetTimerEx("FadeIn", 5, false, "ii", type, 0);

//The callback
forward FadeIn(type, alpha);
public FadeIn(type, alpha)
{
    switch(type)
    {
        case 1:
        {
            alpha += 1;
            //
            new
                R,
                G,
                B,
                A;
            //
            PlayersLoop(i)
            {
                if(IsPlayerConnected(i))
                {
                    for(new k; k < MAX_DNMAINTENANCE_IB_TEXTDRAWS; k++)
                    {
                        get_rgba(gs_MaintenanceInfoBoxColor[k], R, G, B, A);
                        //
                        if(alpha <= A)
                        {
                            printf("DEBUG: FadeIn timer function - Setting alpha %i", A);
                            PlayerTextDrawBoxColor(i, gs_MaintenanceInfoBox[i][k], RGBToHex(R, G, B, alpha));                       PlayerTextDrawShow(i, gs_MaintenanceInfoBox[i][k]);
                        }
                    }
                }
            }
            if(alpha >= 255)
            {
                //If textdraws are faded in, stop the code
                return 1;
            }
            else
            {
                //If not recall timer with increaded alpha
                gs_MaintenanceFadeInTimer = SetTimerEx("FadeIn", 5, false, "ii", type, alpha);
            }
        }
    }
    return 1;
}
So after gmx when I type my debug command for first time the fade effect is crappy and laggy
After that when I type my debug command again and again it's still working fine. I really can't figure problem, when it's working fine on second fade in effect and more.

Video: https://*********/Y6M5vL9vkyI
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)