SA-MP Forums Archive
Timers - Text draw.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timers - Text draw.. (/showthread.php?tid=424010)



Timers - Text draw.. - Anak - 20.03.2013

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..


Re: Timers - Text draw.. - [ABK]Antonio - 20.03.2013

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