[Help] TextDrawDestroy
#1

Hello , i want to Destroy the TextDraw After 5 or 7 seconds

E.G.
PHP код:
new Text:welcomeText
 
public 
OnGameModeInit()
{
    
// This line is used to create the textdraw. 
    // Note: This creates a textdraw without any formatting.
    
welcomeText TextDrawCreate(240.0,580.0,"Welcome to my SA-MP server");
    return 
1;
}
 
public 
OnPlayerConnect(playerid)
{
    
//This is used to show the player the textdraw when they connect.
    
TextDrawShowForPlayer(playerid,welcomeText);

This is the code so i want that when player watch this textdraw , it automatically disappear after 5 seconds.
Reply
#2

So make a timer and function....

pawn Код:
SetTimerEx("DelayTextDrawHide", 6000, false, "ii", playerid, _:welcomeText);

forward DelayTextDrawHide(playerid, Text:id);
public DelayTextDrawHide(playerid, Text:id) { TextDrawHideForPlayer(playerid, id); }
Reply
#3

Use a timer.
pawn Код:
SetTimerEx("TextdrawHide", 5000, false, "d", playerid);

forward public TextdrawHide(playerid);

public TextdrawHide(playerid)
{
    TextDrawHideForPlayer(playerid, welcomeText);
    return 1;
}
EDIT: Pottus was faster than me so I didn't see the post.
Reply
#4

6000 and 5000 is time in seconds?
Reply
#5

Yes the difference between our posts is I made a generic function that would work with any textdraw his only works with one textdraw.
Reply
#6

I want it for 5-7 but you typed 5000/6000 , is that milliseconds?
Reply
#7

Quote:
Originally Posted by Arxalan
Посмотреть сообщение
I want it for 5-7 but you typed 5000/6000 , is that milliseconds?
Yes, for information on natives you should check the wiki

https://sampwiki.blast.hk/wiki/SetTimerEx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)