Update a textdraw each X time
#1

Hi, sorry if I post again but I have a question.

How could I do to set a TextDraw ( Per PLayerTextDraw) to update each 10 seconds for example.

Thank you.
Reply
#2

Use a timer that's set to run every 10 seconds:
pawn Код:
public OnGameModeInit()
{
    // Start a timer which runs every 10 seconds
    SetTimer("Timer10000", 10000, true);

    return 1;
}

// This timer runs every 10 seconds
forward Timer10000();
public Timer10000()
{
    // Loop through all players and only run the timer for each player who's logged in
    for (new playerid; playerid < MAX_PLAYERS; playerid++)
        if (IsPlayerConnected(playerid) == 1)
            PlayerTextDrawSetString(playerid, YourTextDraw, YourMessage);
}
Reply
#3

@PowerPC, use foreach for the loops, so you don't have to check if the player is connected. Just a hint.
Reply
#4

I'm using a variable myself to check if he's logged in (after entering his password correctly).
This would already be pretty fast.

pawn Код:
if (APlayerData[playerid][LoggedIn] == true)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)