Time Left Textdraw -
vassilis - 07.02.2012
Hey guys how i can make the textdraw to show Time Left: xx: xx?
can someone show me a small example code?
Thanks.
Re: Time Left Textdraw -
Konstantinos - 07.02.2012
It's same as a Countdown command. But instead of GameText, you can use the TextDraw.
Re: Time Left Textdraw -
vassilis - 07.02.2012
so i need to make case and case everytime to make a second??i have 5 minutes :/
Re: Time Left Textdraw -
IceCube! - 07.02.2012
No....
SOmthing like
pawn Код:
new Time[MAX_PLAYERS];
stock UpdateTIme(playerid)
{
new string, Min, sec;
if(Time[playerid] > 0)
{
Time[playerid] --;
sec = ((Time[playerid] * 1000));
Minutes = ((Time[playerid] * 1000) / 60);
format(string, sizeof(string), "%s:%s", Min, sec);
TextDrawSetString(TextDrawDefine, string);
SetTimerEx(etc etc);
}
else KillTimer(etc etc);
}
requires neatening
POSTED TO EARLY 2 sec
Re: Time Left Textdraw -
vassilis - 07.02.2012
yes and how i will update the timer..this is my question ;p
Re: Time Left Textdraw -
Konstantinos - 07.02.2012
Just make the TextDraw and the timer. Moreover, a new variable and countdown by "varname --;"
Then to update the Text use
pawn Код:
TextDrawSetString( Text:text, string[ ] );
Re: Time Left Textdraw -
vassilis - 07.02.2012
Quote:
Originally Posted by IceCube!
No....
SOmthing like
pawn Код:
new Time[MAX_PLAYERS];
stock UpdateTIme(playerid) { new string, Min, sec; if(Time[playerid] > 0) { Time[playerid] --; sec = ((Time[playerid] * 1000)); Minutes = ((Time[playerid] * 1000) / 60); format(string, sizeof(string), "%s:%s", Min, sec); TextDrawSetString(TextDrawDefine, string); SetTimerEx(etc etc); } else KillTimer(etc etc); }
requires neatening
POSTED TO EARLY 2 sec
|
so as far as i understood
-topof script Timer[MAX_PLAYERS];
-making a stock
-the textdraw..textdraw string
-but where i have to put the timer callback?
Re: Time Left Textdraw -
IceCube! - 07.02.2012
Stock was a stupid example it doesnt have to be in one I didnt even return a value.
Just call keep calling it every second. Until the value = 0. I dont know if there is a more efficent way. And you want to call it by player so like
SetTimerEx("function", 1000, true, "i", playerid);
You want to move my stock to a forward and public.
Kill the timer if the value of Time = 0
Remove the Timer I put in the stock that was a stupid place to put it as the timer would have to be false that way causing to to loop and star over instad of looping automaticly
EDIT: Infact I'll add some code here
pawn Код:
new Time[MAX_PLAYERS];
new FunctionTimer[MAX_PLAYERS];
forward function(playerid);
public function(playerid)
{
new string, Min, sec;
if(Time[playerid] > 0)
{
Time[playerid] --;
sec = ((Time[playerid] * 1000));
Minutes = ((Time[playerid] * 1000) / 60);
format(string, sizeof(string), "%s:%s", Min, sec);
TextDrawSetString(TextDrawDefine, string);
}
else KillTimer(FuntionTimer[playerid]);
return 1;
}
CMD:mycommand(playerid, params[])
{
//code
FuntionTimer[targetid/playerid] = SetTimerEx("function", 1000, true, "i", playerid);
return 1;
}
Somthing like this or you coould use Y_Timers.
Sorry if this isnt well explained I cant really explain things. Also Sorry for my spelling it might be a problem.
Re: Time Left Textdraw -
Zaec - 07.02.2012
Whats does mean "Minutes" ? Its timer time?