13.09.2012, 19:42
How can i make a countdown and display how long left on a textdraw? i kinda failed (countdwon was from 12 but only went to 11)
new countn[MAX_PLAYERS];//It will count down,or normally,as you choose..
forward TimerName(playerid);//This is the function that will define the timer
new timer[MAX_PLAYERS];//This is the name of the timer,but there's one particulary for every player,as if we want to destroy it,it won't destroy for everyone
COMMAND:starttimer(playerid,params[])
{
countn[playerid]=10;//It will count for 10 seconds
timer[playerid]=SetTimerEx("TimerName",1000,true,"i",playerid);/We set the timer for 10 seconds,as you can see
return 1;
}
//We now define the timer,like this:
public TimerName(playerid)
{
countn[playerid]--;//The timer decreases from 10 to 0
if(countn[playerid]>=-1)
{
KillTimer(timer[playerid]);
//code[What your timer actually does]
}
return 1;
}
countn[playerid]--;//The timer decreases from 10 to 0
if(countn[playerid]>=-1)
{
KillTimer(timer[playerid]);
//code[What your timer actually does]
}