TextDraw's timers intersecting
#1

I have a little problem with my textdraws, they are intersecting and when one updates the other does the same...
Ex: One is set to update in 1 second and the other in 2 seconds, this will result that both will update in 1 second ... and this is not good

Here are the codes ...

pawn Код:
SetTimer("UpdateTime",1000,1);

public UpdateTime()
{
    gettime(hour, minute, second);
    format(timestr,32,"%02d:%02d:%02d",hour,minute,second);
    TextDrawSetString(txtTimeDisp,timestr);

    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            TextDrawShowForPlayer(i,txtTimeDisp);
        }
    }
    new x=0;
    while(x!=MAX_PLAYERS) {
        if(IsPlayerConnected(x) && GetPlayerState(x) != PLAYER_STATE_NONE) {
            //SetPlayerTime(x,hour,minute);
         }
         x++;
    }
}
pawn Код:
SetTimer("CheckStatus", 2000 1);

public CheckStatus()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(gGasBoard[i] == 1)
            {
                if(IsPlayerInAnyVehicle(i))
                {
                    if(TextShow[i] == false)
                    {
                        TextDrawShowForPlayer(i, Text:Black0);
                        TextDrawShowForPlayer(i, Text:Black1);
                        TextDrawShowForPlayer(i, Text:Black2);
                        TextDrawShowForPlayer(i, Text:Black3);
                        TextDrawShowForPlayer(i, Text:LightBlack);
                        TextShow[i] = true;
                    }
                    new String[128];
                    new Float:X, Float:Y, Float:Z, Float:Speed;
                    new vehicle = GetPlayerVehicleID(i);
                    GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
                    Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)),  floatpower(Z, 2))), 100.0);
                    format(String,sizeof(String),"~b~Car~n~~r~Fuel: ~w~%i~n~~r~km/h: ~w~%i", Gas[vehicle], floatround(Speed, floatround_floor));
                    if(VHSCreated[i] == true)
                    {
                        TextDrawDestroy(VHS[i]);
                    }
                    VHS[i] = TextDrawCreate(541.000000,137.000000,String);
                    TextDrawAlignment(VHS[i],0);
                    TextDrawBackgroundColor(VHS[i],0x000000ff);
                    TextDrawFont(VHS[i],1);
                    TextDrawLetterSize(VHS[i],0.299999,1.000000);
                    TextDrawColor(VHS[i],0xffffffff);
                    TextDrawSetOutline(VHS[i],1);
                    TextDrawSetProportional(VHS[i],1);
                    TextDrawSetShadow(VHS[i],1);
                    TextDrawShowForPlayer(i, VHS[i]);
                    VHSCreated[i] = true;
                }
                else
                {
                    if(TextShow[i] == true)
                    {
                        TextDrawHideForPlayer(i, Text:Black0);
                        TextDrawHideForPlayer(i, Text:Black1);
                        TextDrawHideForPlayer(i, Text:Black2);
                        TextDrawHideForPlayer(i, Text:Black3);
                        TextDrawHideForPlayer(i, Text:LightBlack);
                        TextDrawHideForPlayer(i, Text:VHS[i]);
                        TextShow[i] = false;
                    }
                }
            }
            else if(gGasBoard[i] == 0)
            {
                TextDrawHideForPlayer(i, Text:Black0);
                TextDrawHideForPlayer(i, Text:Black1);
                TextDrawHideForPlayer(i, Text:Black2);
                TextDrawHideForPlayer(i, Text:Black3);
                TextDrawHideForPlayer(i, Text:LightBlack);
                TextDrawHideForPlayer(i, Text:VHS[i]);
                TextShow[i] = false;
            }
        }
    }
}

Any solutions ? Thanks !
Reply
#2

Bump ... ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)