show a textdraw for defined time - 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: show a textdraw for defined time (
/showthread.php?tid=452721)
show a textdraw for defined time -REP++ -
Visio - 22.07.2013
i just try to make a textdraw,a message with some information,but i fail to do the textdraw to be showed for just 5 seconds=5000 miliseconds.can someone to shown me an exemple?
Re: show a textdraw for defined time -
Visio - 22.07.2013
rep ++
Re: show a textdraw for defined time -
Visio - 23.07.2013
please help
Re: show a textdraw for defined time -
RajatPawar - 23.07.2013
pawn Код:
new Text:my_textdraw;
new _timer;
new bool: shown = false;
forward public text_timer();
public OnFilterScriptInit()
{
my_textdraw = TextDrawCreate(125, 125, "__");
_timer = SetTimer("text_timer", 5000, 1);
return 1;
}
public text_timer()
{
switch(shown)
{
case true:
{
TextDrawHideForAll(my_textdraw);
shown = !shown;
}
case false:
{
TextDrawShowForAll(my_textdraw);
shown = !shown;
}
}
return 1;
}
An example of a 'flashing' textdraw. You can just set the '1' in SetTimer to 0 to show it once.
Re: show a textdraw for defined time -
Visio - 23.07.2013
i have a problem,i do how you say:
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsPlayerInRangeOfPoint(playerid,100,-66.5552,-1128.7533,1.0781) && IsATruck(vehicleid) && !IsTrailerAttachedToVehicle(vehicleid))
{
//TextDrawShowForPlayer(playerid, Textdraw020);
_timer = SetTimer("text_timer", 5000, 0);
}
PHP код:
new _timer;
new bool: shown = false;
forward public text_timer();
public text_timer()
{
switch(shown)
{
case true:
{
TextDrawHideForAll(Textdraw020);
shown = !shown;
}
case false:
{
TextDrawShowForAll(Textdraw020);
shown = !shown;
}
}
return 1;
}
but the problem is that when i enter in car,after 5 seconds the textdraw appear but not disappear
AW: show a textdraw for defined time -
Macronix - 23.07.2013
Mmh, i have this code:
pawn Код:
forward TimeTextForPlayer(playerid, Text:text, time);
forward DestroyTextTimerForPlayer(playerid,Text:text);
public TimeTextForPlayer(playerid, Text:text, time)
{
TextDrawShowForPlayer(playerid, text);
SetTimerEx("DestroyTextTimerForPlayer", time, 0, "di", playerid, _:text);
}
public DestroyTextTimerForPlayer(playerid, Text:text)
{
//TextDrawDestroy(text);
TextDrawHideForPlayer(playerid, text);
}
.. and then you just use it like this:
pawn Код:
TimeTextForPlayer(playerid, YOUR_TEXTDRAW, YOUR_TIME);
Re: show a textdraw for defined time -
Visio - 23.07.2013
perfect man,thank you