textdraw problem
#1

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.
Reply
#2

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);
            }
Reply
#3

Thanks .
Reply
#4

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.
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)