show a textdraw for defined time
#1

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

rep ++
Reply
#3

please help
Reply
#4

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

i have a problem,i do how you say:
PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    if(
IsPlayerInRangeOfPoint(playerid,100,-66.5552,-1128.7533,1.0781) && IsATruck(vehicleid) && !IsTrailerAttachedToVehicle(vehicleid))
        {
            
//TextDrawShowForPlayer(playerid, Textdraw020);
            
_timer SetTimer("text_timer"50000);
        } 
PHP код:
new _timer;
new 
boolshown 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
Reply
#6

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

perfect man,thank you
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)