SA-MP Forums Archive
textdraw problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: textdraw problem (/showthread.php?tid=181939)



textdraw problem - Mr.Ilusion - 08.10.2010

Hello everyone, i have a problem with an textdraw.
On right top I made a textdraw called "Low health", and when you have health under 10 the message will be shown.
My problem is: The message appears at any health level.
I have at OtherTimer():

Код:
new Float:health;
            GetPlayerHealth(playerid,health);
            if (health < 11)
            {
                SetTimer("ShowPlayerHealthNotification", 1000, 0);
            }
And this:
Код:
public ShowPlayerHealthNotification(playerid)
{
	TextDrawShowForPlayer(playerid, Lowhealth);
	SetTimer("ShowPlayerHealthNotification2", 600, 0);
}
public ShowPlayerHealthNotification2(playerid)
{
	TextDrawHideForPlayer(playerid, Lowhealth);
	TextDrawShowForPlayer(playerid, Lowhealth2);
	SetTimer("ShowPlayerHealthNotification", 600, 0);
}
I don't understand what's the problem xD.


Re: textdraw problem - Voldemort - 08.10.2010

pawn Код:
SetTimerEx("ShowPlayerHealthNotification",1000, 0,"i",playerid);
and I guess OtherTimer() uses for(new i..., so you will need
pawn Код:
new Float:health;
            GetPlayerHealth(i,health);
            if (health < 11)
            {
                SetTimerEx("ShowPlayerHealthNotification",1000, 0,"i",i);
            }



Re: textdraw problem - Mr.Ilusion - 08.10.2010

Thanks .


Re: textdraw problem - iggy1 - 08.10.2010

If your using this for multiple players i suggest using an array for your textdraw ids.
eg,
pawn Код:
TextDrawHideForPlayer(playerid, Lowhealth[playerid]);
and obviously "new Text:Lowhealth[MAX_PLAYERS];" somewhere too.


Re: textdraw problem - Lenny the Cup - 08.10.2010

Don't use SA-MP timers, especially for something like this. Use OnPlayerUpdate. SA-MP timers are inefficient.