Time Left Textdraw
#1

Hey guys how i can make the textdraw to show Time Left: xx: xx?

can someone show me a small example code?
Thanks.
Reply
#2

It's same as a Countdown command. But instead of GameText, you can use the TextDraw.
Reply
#3

so i need to make case and case everytime to make a second??i have 5 minutes :/
Reply
#4

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
Reply
#5

yes and how i will update the timer..this is my question ;p
Reply
#6

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[ ] );
Reply
#7

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?
Reply
#8

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.
Reply
#9

Whats does mean "Minutes" ? Its timer time?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)