TextDraw help -
Bulgaria - 01.04.2015
Hello can someone help me to set timer for this ?
PHP код:
Textdraw0 = TextDrawCreate(25.000000,128.000000,"Welcome to Severozapada. Have a nice play. ADMIN");
TextDrawUseBox(Textdraw0,1);
TextDrawBoxColor(Textdraw0,0x00000066);
TextDrawTextSize(Textdraw0,208.000000,-19.000000);
TextDrawAlignment(Textdraw0,0);
TextDrawBackgroundColor(Textdraw0,0x000000ff);
TextDrawFont(Textdraw0,1);
TextDrawLetterSize(Textdraw0,0.400000,1.600000);
TextDrawColor(Textdraw0,0xffffffff);
TextDrawSetOutline(Textdraw0,1);
TextDrawSetProportional(Textdraw0,1);
TextDrawSetShadow(Textdraw0,1);
When i connect this text show up but don dissapear i want to set timer to this and when timer end the text to hide

Sorry for my bad english thx in advance
Re: TextDraw help -
CalvinC - 01.04.2015
https://sampwiki.blast.hk/wiki/SetTimer
Re: TextDraw help -
Bulgaria - 01.04.2015
ammm i'm a beginner and i dont know how to add... :/
Re: TextDraw help -
Ritzy2K - 01.04.2015
Use SetTimerEx... sorry cant link you up to the wiki since im on phone...neither i can make a code for you atm.
then basically define that public code that the timer is going to use
forward TTimerNam(playerid);
then ur time function
public TimerName(playerid)
and in the public function hide all the textdraw which u have shown before
use wiki samp... and look for SetTimerEx
Re: TextDraw help -
Bulgaria - 01.04.2015
i really dont know it's hard to me ......... i'm sorry....... :/
Re: TextDraw help -
CalvinC - 01.04.2015
If you're using the textdraw globally, which it looks like, there's no need to use SetTimerEx.
Here's an example to set up your timer:
Where you display the textdraw, start the timer
pawn Код:
SetTimer("MyPublic", 4000, false);
"MyPublic" - The public the timer will call when it ends
4000 - The time it takes before the public is called
false - A boolean(true/false) if the timer should repeat or not, we don't want it to repeat, just be called once, so we use false
Now the public:
pawn Код:
forward MyPublic(); // When creating a public function, you always need to forward it
public MyPublic() // The public the timer will call, any code under the public will be executed when the timer ends
{
foreach(new i: Player) // Loop through all players, assuming you have the textdraw globally for all players
{
TextDrawHideForPlayer(i, Textdraw0); // Hide the textdraw for all players, "i"
}
}
If you only have the textdraw for 1 person at a time, you should use [playerid] on your variable, as well as SetTimerEx.
If you're using it for a cmd etc:
/welcomeall
Loop through all players and show the textdraw
Then just set the public up like in the example.
Re: TextDraw help -
Bulgaria - 01.04.2015

i talk about for this
Re: TextDraw help -
CalvinC - 01.04.2015
So you're using it when a player connects?
Then you should use SetTimerEx.
Basically instead of the SetTimer:
pawn Код:
SetTimer("MyPublic", 4000, false, "i", playerid);
"i" - Which format to use, the players ID is a number, so we use an integer (i or d)
playerid - What integer(number) should we pass on? The playerid.
And then the public and forwards parameters should contain "playerid", so you don't need a loop, just hide it for playerid:
pawn Код:
forward MyPublic(playerid); // When creating a public function, you always need to forward it
public MyPublic(playerid) // The public the timer will call, any code under the public will be executed when the timer ends
{
TextDrawHideForPlayer(playerid, Textdraw0[playerid]); // Hide the textdraw for playerid
}
Re: TextDraw help -
Bulgaria - 01.04.2015

something like this
Re: TextDraw help -
CalvinC - 01.04.2015
Nvm about the array part, but read the rest.