TextDraw only for player
#1

hi,

as soon as a player got less than 20% of life i want that a textdraw shows upand hides again so i get a kind of flash effect.
Well, for me it works but if there are are more players on the server its buggy.
The textdraw also shows up for other players but i dont know why cause i used settimerex and textdrawforplayer.
Some help would be great

pawn Код:
public OnPlayerUpdate(playerid)
{

    new Float:HealthLow;

    GetPlayerHealth(playerid,HealthLow);
    if(HealthLow < 20)
    {
    if(lowhactive[playerid] == 1)
    {
    SetTimerEx("LowHealthFlash1",1000,false,"i",playerid);
    lowhactive[playerid] = 0;
    }
    }
   
    else if(HealthLow > 20)
    {
    KillTimer(LHFT1);
    KillTimer(LHFT2);
    KillTimer(LHFT3);
    TextDrawHideForPlayer(playerid,wastedlh);
    lowhactive[playerid] = 1;
    }
}

forward LowHealthFlash1(playerid);
public LowHealthFlash1(playerid)
{
LHFT1 = SetTimerEx("LowHealthFlash2",500,false,"i",playerid);
TextDrawShowForPlayer(playerid,wastedlh);
}

forward LowHealthFlash2(playerid);
public LowHealthFlash2(playerid)
{
LHFT2 = SetTimerEx("LowHealthFlash3",500,false,"i",playerid);
TextDrawHideForPlayer(playerid,wastedlh);
}

forward LowHealthFlash3(playerid);
public LowHealthFlash3(playerid)
{
LHFT3 = SetTimerEx("LowHealthFlash2",500,false,"i",playerid);
TextDrawShowForPlayer(playerid,wastedlh);
}
Reply
#2

Show your text draw creation code.

Peace....
Reply
#3

pawn Код:
wastedlh = TextDrawCreate(-1.000000, 0.000000, "WASTED");
TextDrawBackgroundColor(wastedlh, 255);
TextDrawFont(wastedlh, 2);
TextDrawLetterSize(wastedlh, -0.000000, 49.699966);
TextDrawColor(wastedlh, -16776961);
TextDrawSetOutline(wastedlh, 1);
TextDrawSetProportional(wastedlh, 1);
TextDrawUseBox(wastedlh, 1);
TextDrawBoxColor(wastedlh, -8882026);
TextDrawTextSize(wastedlh, 648.000000, 11.000000);
thx for answering but what do u need the creation code for?
Reply
#4

Is that under OnGameModeInit() or OnPlayerConnect ?

I think your creating a global textdraw for every 1.

new HealthLow[MAX_PLAYERS];
Might help.

Peace...
Reply
#5

its under on game mode init.

and defined like this:

pawn Код:
new Text:wastedlh;
ill try it with
pawn Код:
new Text:wastedlh[MAX_PLAYERS];
thx but does it really make sense for my problem?
Reply
#6

Quote:
Originally Posted by BlackWolf120
Посмотреть сообщение
its under on game mode init.

and defined like this:

pawn Код:
new Text:wastedlh;
ill try it with
pawn Код:
new Text:wastedlh[MAX_PLAYERS];
thx but does it really make sense for my problem?
Create the TextDraw onplayerconnect.

Peace...
Reply
#7

sorry for asking but what does it change if i create it under OnPlayerConnect?
And shall i try your first suggestion?
Reply
#8

You can actually use zamaroht's TextDraw editor, it really helps in these cases!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)