SA-MP Forums Archive
Some help with timer - 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: Some help with timer (/showthread.php?tid=635674)



Some help with timer - fireranger11 - 11.06.2017

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);
}



Re: Some help with timer - Sew_Sumi - 11.06.2017

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.


Re: Some help with timer - fireranger11 - 11.06.2017

Tell me how


Re: Some help with timer - fireranger11 - 11.06.2017

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

EDIT: 2of the textdraws


Re: Some help with timer - Sew_Sumi - 11.06.2017

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

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


Re: Some help with timer - fireranger11 - 11.06.2017

Does that mean, i cant do that to 3textdraws?


Re: Some help with timer - Sew_Sumi - 11.06.2017

You can, but it's an unnecessary waste.


Re: Some help with timer - fireranger11 - 11.06.2017

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


Re: Some help with timer - Sew_Sumi - 11.06.2017

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


Re: Some help with timer - fireranger11 - 11.06.2017

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