14.06.2007, 19:16
Heres a little function which will display text for an amount of milliseconds and then destroy it for you.
Function: TimeTextForPlayer(playerid, Text:text, time).
text = the text you want to display
time = amount of time, in milliseconds
It will give you a tag mismatch warning because of the Text label on the variable, but it doesnt matter because in the end its still just an integer.
Example usage:
EDIT: thx Simon, updated.
pawn Code:
forward DestroyTextTimer(Text:text);
TimeTextForPlayer(playerid, Text:text, time)
{
TextDrawShowForPlayer(playerid,text);
SetTimerEx("DestroyTextTimer",time,0,"i",_:text); // _: from Simon
}
public DestroyTextTimer(Text:text)
{
TextDrawDestroy(text);
}
text = the text you want to display
time = amount of time, in milliseconds
It will give you a tag mismatch warning because of the Text label on the variable, but it doesnt matter because in the end its still just an integer.
Example usage:
pawn Code:
new Text:text = TextDrawCreate(20.0, 300.0,"I like pie");
TextDrawUseBox(text, 1);
TextDrawBoxColor(text, 0x000000AA);
TextDrawFont(text, 1);
TextDrawSetShadow(text,0);
TextDrawSetOutline(text,1);
TextDrawBackgroundColor(text,0x000000FF);
TextDrawColor(text,0xFFFFFFFF);
TimeTextForPlayer(playerid,text,6000);