Some help with timer
#1

I want the timer to be killed first and then set a new timer
PS: It is used for teleport messages.
Код:
stock SendBoxMsg(string[])
{
   if(CurrentMsg == 0)
   {
	 TextDrawShowForAll(box0);
	 TextDrawSetString(box0,string);
	 KillTimer(box0tdtimer);
     box0tdtimer = SetTimer("box0td", 10000, true);
     CurrentMsg++;
   }
   else if(CurrentMsg == 1)
   {
     TextDrawShowForAll(box1);
	 TextDrawSetString(box1,string);
	 KillTimer(box1tdtimer);
	 box1tdtimer = SetTimer("box1td", 10000, true);
	 CurrentMsg++;
   }
   else if(CurrentMsg == 2)
   {
     TextDrawShowForAll(box2);
	 TextDrawSetString(box2,string);
	 KillTimer(box2tdtimer);
	 box2tdtimer = SetTimer("box2td", 10000, true);
	 CurrentMsg = 0;
}
  	else if(CurrentMsg >= 3)
   {
	 CurrentMsg = 0;
   }
}
Код:
forward box0td(playerid);
public box0td(playerid)
{
    TextDrawHideForAll(box0);
    CurrentMsg = 0;
}
forward box1td(playerid);
public box1td(playerid)
{
    TextDrawHideForAll(box1);
    CurrentMsg = 0;
}
forward box2td(playerid);
public box2td(playerid)
{
    TextDrawHideForAll(box2);
}
Reply
#2

You can do this in such a better way. Pretty sure you only need the one textdraw, and change its string. Same for a single timer.
Reply
#3

Tell me how
Reply
#4

I got a problem with my current format,
one of the textdraws(random) is not hiding

EDIT: 2of the textdraws
Reply
#5

use the one... You don't need multiple textdraws for this.

You've simply over-complicated your code. That's all.
Reply
#6

Does that mean, i cant do that to 3textdraws?
Reply
#7

You can, but it's an unnecessary waste.
Reply
#8

1Textdraw looks ugly, thats why i did 3textdraws, can u please tell me how do i fix the problem
Reply
#9

How'd it look ugly?

You more than likely just need to give better attention to the extra parameters in the making of the textdraws. Even look towards making a scrolling textdraw with messages to avoid any 'ugliness'.
Reply
#10

I would, if i can :P im a newbie, can you tell me about fixing this error as well, so ican learn this shit as well
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)