"sleep" function
#1

Hey guys,
Im working on a damage display. I made a textdraw which shows how much dmg the person makes. After 2 seconds, the textdraw is set to "hide". The problem is, the "sleep" function which i use, does lag the script sometimes.

Is there any other way to make a sleep or a delay for the text to hide?
Reply
#2

https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#3

How should i do that? oO
I mean yeah i can set a timer and so on, but i cant just port my textdraw and IDs to the timer function... That would be a mess
Reply
#4

Quote:
Originally Posted by Blunt P
Посмотреть сообщение
How should i do that? oO
I mean yeah i can set a timer and so on, but i cant just port my textdraw and IDs to the timer function... That would be a mess
As the above person gave you a pair of links you could use those links and learn how to use a timer. You can use such timers for delaying the textdraw if you want.

-FalconX
Reply
#5

Quote:
Originally Posted by ue_falconx
Посмотреть сообщение
As the above person gave you a pair of links you could use those links and learn how to use a timer. You can use such timers for delaying the textdraw if you want.

-FalconX
i accually know howto use them.... My problem is, i would have some trouble porting the data from my OnPlayerGiveDamage to my timer function.

PHP код:
here an example:
public 
OnPlayerGiveDamagewhateva(playeridissueridFloatamount)
{
    if(
IsPlayerConnected(playerid))
    {
        new 
Text:Textdraw0string[64];
        
format(stringsizeof(string), "%.0f dmg"amount);
        
Textdraw0 TextDrawCreate(x,y,string);
        
TextDrawShowForPlayer(issuerid,Textdraw0);
    }return 
1;

If i would make a timer. How should i use TextDrawHideForPlayer? I cant just write TextDrawHideForPlayer(issuerid,Textdraw0), because id have to make a new textdraw, which wouldnt delete the one from Givedamage...
Reply
#6

pawn Код:
SetTimerEx("hidetd", timehere, 0, "i", issuerid);
Might want to do the new Text:Textdraw0; globally though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)