Timers - Text draw..
#1

hey how can i make timer to show on right bottom corner on the screen for timer :

pawn Код:
SetTimerEx("Unfreeze_skydive", 5*1000, false, "i", playerid); // in command...


forward Unfreeze_skydive(playerid);


public Unfreeze_skydive(playerid)
{
    GameTextForPlayer(playerid,"~w~Now skydive!",4000,3);
    SendClientMessage(playerid , COLOR_YELLOW, "5 seconds have been passed. You have started to skydive.");
}
can you please give me simple example..
Reply
#2

pawn Код:
//outside of the command
#define SkyDiveTime     5 //this would be in seconds
new TmpTimerVar[MAX_PLAYERS], TmpTimerSecondsPassed[MAX_PLAYERS];

//inside of the command
TmpTimerVar[playerid]=SetTimerEx("Unfreeze_skydive", 1000, true, "i", playerid); // we want it to repeat every second



public Unfreeze_skydive(playerid)
{
    TmpTimerSecondsPassed[playerid]++; //increase how many seconds have passed
    if(TmpTimerSecondsPassed[playerid] != SkyDiveTime)
    {
        new string[25];
        format(string, sizeof(string), "~w~Skydiving in %i seconds!", SkyDiveTime-TmpTimerSecondsPassed[playerid]);
        GameTextForPlayer(playerid,string,1000,1);
    }
    else
    {
        GameTextForPlayer(playerid,"~w~Now skydive!",4000,3);
        //SendClientMessage(playerid , COLOR_YELLOW, "5 seconds has passed. You have started to skydive.");
        TmpTimerSecondsPassed[playerid]=0; //reset our second counter for future use
        KillTimer(TmpTimerVar[playerid]); //kill that timer since we made it repeating
    }
}
That should work. If it doesn't, feel free to post. Tbh, there's no need to make a textdraw since there's already a gametext style for it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)