What the hell? :s
#1

I've just faced with very annoying "bug". I created clock system (hh : mm : ss) (textdraw) and EVERYTHING works fine, clock shows, time is correct, everything's fine. But one thing sucks. I created another system before, when you enter or exit building, screen fades in and out, and this is it! When that 'fading textdraw box' starts showing (and transparency drops, increases), black and very scaled seconds' text in the middle of screen (when fading out finishes "bugged" text disappears as well). But remember, that my hours, minutes and seconds original text in the corner of the screen is working perfectly. What the hell is happening? Here is some code:

pawn Код:
// on the top
new PlayerText: clock[MAX_PLAYERS]; // "00:00"
new PlayerText: clock_sec[MAX_PLAYERS]; // ":00"

//- - - - - - - - - - -

stock CreatePlayerClock(playerid)
{
    // Hours and minutes
    clock[playerid] = CreatePlayerTextDraw(playerid,547.000000,22.000000,"00:00");
    PlayerTextDrawAlignment(playerid,clock[playerid],0);
    PlayerTextDrawBackgroundColor(playerid,clock[playerid],0x000000ff);
    PlayerTextDrawFont(playerid,clock[playerid],3);
    PlayerTextDrawLetterSize(playerid,clock[playerid],0.399999,1.700000);
    PlayerTextDrawColor(playerid,clock[playerid],0xffffffff);
    PlayerTextDrawSetOutline(playerid,clock[playerid],1);
    PlayerTextDrawSetProportional(playerid,clock[playerid],1);
    PlayerTextDrawSetShadow(playerid,clock[playerid],1);
   
    // Seconds
    clock_sec[playerid] = CreatePlayerTextDraw(playerid,586.000000,25.000000,":00");
    PlayerTextDrawAlignment(playerid,clock_sec[playerid],0);
    PlayerTextDrawBackgroundColor(playerid,clock_sec[playerid],0x000000ff);
    PlayerTextDrawFont(playerid,clock_sec[playerid],3);
    PlayerTextDrawLetterSize(playerid,clock_sec[playerid],0.299999,1.300000);
    PlayerTextDrawColor(playerid,clock_sec[playerid],0xffffffff);
    PlayerTextDrawSetOutline(playerid,clock_sec[playerid],1);
    PlayerTextDrawSetProportional(playerid,clock_sec[playerid],1);
    PlayerTextDrawSetShadow(playerid,clock_sec[playerid],1);
    return 1;
}

//- - - - - - - - - - - -

stock PlayerSpawn(playerid, team, skin, Float:x,Float:y,Float:z,Float:a,g,gb,h,hb,j,jb) // this stock is called when player enters correct password and this function executes only once per player.
{
// some code not with clocks
    CreatePlayerClock(playerid);

    if(pInfo[playerid][clock] == 1) {PlayerTextDrawShow(playerid,clock[playerid]); PlayerTextDrawShow(playerid,clock_sec[playerid]);} // if player has a clock in his inventory...
    return 1;
}


//- - - - - - -

public OnGameModeInit()
{
    SetTimer("Time",100,true); // will update every player's clock
    return 1;
}

public Time()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(pInfo[i][clock] == 1)
        {
            new string[20];
            format(string,sizeof(string),"%02i:%02i",h,m);
            PlayerTextDrawSetString(i, clock[i],string);
            format(string,sizeof(string),":%02i",s);
            PlayerTextDrawSetString(i, clock_sec[i],string);
        }
    }
}
Also, I found out, that the "bugged" text is :36 (yeah, seconds. But these seconds were when PlayerSpawn function was called.)
Reply
#2

Anyone?
Reply
#3

Can you post the screen fades in/out code?
Reply
#4

I suppose the time is the same for each player, in which case two regular global textdraws would be more than sufficient.
Reply
#5

That's the fades code:
pawn Код:
forward FadeOut(playerid, A);
forward FadeIn(playerid, A);
//------
public FadeIn(playerid, A)
{
    PlayerTextDrawBoxColor(playerid, Background[playerid], RGBToHex(0,0,0,A));
    PlayerTextDrawShow(playerid, Background[playerid]);
    if (A) SetTimerEx("FadeIn", DELAY, false, "id", playerid, A-1); else PlayerTextDrawHide(playerid, Background[playerid]);
    return 1;
}
public FadeOut(playerid, A)
{
    PlayerTextDrawBoxColor(playerid, Background[playerid], RGBToHex(0,0,0,A));
    PlayerTextDrawShow(playerid, Background[playerid]);
    if (A < 255) SetTimerEx("FadeOut", DELAY, false, "id", playerid, A+1);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)