"sleep" function - 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: "sleep" function (
/showthread.php?tid=321425)
"sleep" function -
Blunt P - 26.02.2012
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?
Re: "sleep" function -
MP2 - 26.02.2012
https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/SetTimerEx
AW: Re: "sleep" function -
Blunt P - 26.02.2012
Quote:
Originally Posted by MP2
|
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
Re: AW: Re: "sleep" function -
FalconX - 26.02.2012
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
AW: Re: AW: Re: "sleep" function -
Blunt P - 26.02.2012
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(playerid, issuerid, Float: amount)
{
if(IsPlayerConnected(playerid))
{
new Text:Textdraw0, string[64];
format(string, sizeof(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...
Re: "sleep" function -
iTorran - 26.02.2012
pawn Код:
SetTimerEx("hidetd", timehere, 0, "i", issuerid);
Might want to do the
new Text:Textdraw0; globally though.