About 3dTextLabel
#1

Hi, i have this system that checks if the player is paused/tabbed.
But sometimes when you just login to the server it will attach a label to you
saying that you have been paused for example: 12674654 minutes. What can that cause?

This on top of gamemode
pawn Код:
new Text3D:minpause[MAX_PLAYERS];
And this on OnPlayerDisConnect
pawn Код:
Delete3DTextLabel(minpause[playerid]);
This on OnPlayerConnect
pawn Код:
minpause[playerid] = Create3DTextLabel(" ", COLOR_BIZ, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(minpause[playerid],playerid, 0.0, 0.0, 0.7);

This is the timer that will attach the label when you are tabbed/paused
pawn Код:
for (new i, j = GetPlayerPoolSize(); i <= j; i++)
    {
        new PausedSeconds = gettime()-PauseTime[i], string[50];
        if(PausedSeconds < 120 && PausedSeconds > 59) // check if it's above 1 minute.  secspause minpause minspause
        {
            format(string, 50, ""COL_AFK"PAUSED\n%d minute\n|\nV\n \n \n", SecondsToMinutes(PausedSeconds));
            Update3DTextLabelText(minpause[i], COLOR_BIZ, string);
        }
        else if(PausedSeconds > 120) // checks if it's below 2 minutes
        {
            format(string, 50, ""COL_AFK"PAUSED\n%d minutes\n|\nV\n \n \n", SecondsToMinutes(PausedSeconds));
            Update3DTextLabelText(minpause[i], COLOR_BIZ, string);
        }
        else if(PausedSeconds < 60 && PausedSeconds > 3) // checks if it's below 1 minute but above 0 seconds.
        {
            format(string, 50, ""COL_AFK"PAUSED\n%d seconds\n|\nV\n \n \n", PausedSeconds);
            Update3DTextLabelText(minpause[i], COLOR_BIZ, string);
        }
    }

And this will remove the label when you are no longer paused

    for (new i, j = GetPlayerPoolSize(); i <= j; i++)
    {
        new PausedSeconds = gettime()-PauseTime[i], string[50];
        if(PausedSeconds == 0)
        {
            format(string, 50, " ");
            Update3DTextLabelText(minpause[i], COLOR_BIZ, string);
        }
    }
Reply
#2

You need to reset PauseTime[playerid] in OnPlayerConnect.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)