hp td
#5

Try a different approach. Untested and unsure if it works. Basically, the reason it is flashing is because you're updating the textdraws on OnPlayerUpdate instead of OnPlayerTakeDamage.

pawn Код:
new PlayerText: HPP[MAX_PLAYERS]; //Or whatever the textdraw name is.

public OnGameModeInit (){
    for(new i = 0; i < MAX_PLAYERS; i++){
        //create the textdraws here
    }
    return 1;
}

forward UpdateHealthTD(playerid);
public UpdateHealthTD(playerid) {
    if(connected[playerid] == false)
            {
            new Float:hptd;
            GetPlayerHealth(playerid, hptd);
            if(hptd >= 100)
            {
                PlayerTextDrawHide(playerid, HPP[playerid]);
                PlayerTextDrawBackgroundColor(playerid,HPP[playerid], 16711935);
                PlayerTextDrawFont(playerid,HPP[playerid], 3);
                PlayerTextDrawLetterSize(playerid,HPP[playerid], 0.449999, 1.800000);
                PlayerTextDrawSetOutline(playerid,HPP[playerid], 1);
                PlayerTextDrawSetProportional(playerid,HPP[playerid], 1);
                PlayerTextDrawShow(playerid, HPP[playerid]);
                PlayerTextDrawColor(playerid, HPP[playerid], 255);

            }
            else if(hptd > 65)
            {
                PlayerTextDrawHide(playerid, HPP[playerid]);
                PlayerTextDrawBackgroundColor(playerid,HPP[playerid], -65281);
                PlayerTextDrawFont(playerid,HPP[playerid], 3);
                PlayerTextDrawLetterSize(playerid,HPP[playerid], 0.449999, 1.800000);
                PlayerTextDrawSetOutline(playerid,HPP[playerid], 1);
                PlayerTextDrawSetProportional(playerid,HPP[playerid], 1);
                PlayerTextDrawShow(playerid, HPP[playerid]);
                PlayerTextDrawColor(playerid, HPP[playerid], 255);
            }
            else if(hptd > 50)
            {
                PlayerTextDrawHide(playerid, HPP[playerid]);
                PlayerTextDrawBackgroundColor(playerid,HPP[playerid], -5963521);
                PlayerTextDrawFont(playerid,HPP[playerid], 3);
                PlayerTextDrawLetterSize(playerid,HPP[playerid], 0.449999, 1.800000);
                PlayerTextDrawSetOutline(playerid,HPP[playerid], 1);
                PlayerTextDrawSetProportional(playerid,HPP[playerid], 1);
                PlayerTextDrawShow(playerid, HPP[playerid]);
                PlayerTextDrawColor(playerid, HPP[playerid], 255);
            }
            else if(hptd >= 1)
            {
                PlayerTextDrawHide(playerid, HPP[playerid]);
                PlayerTextDrawBackgroundColor(playerid, HPP[playerid], -16776961);
                PlayerTextDrawFont(playerid,HPP[playerid], 3);
                PlayerTextDrawLetterSize(playerid,HPP[playerid], 0.449999, 1.800000);
                PlayerTextDrawSetOutline(playerid,HPP[playerid], 1);
                PlayerTextDrawSetProportional(playerid,HPP[playerid], 1);
                PlayerTextDrawShow(playerid, HPP[playerid]);
                PlayerTextDrawColor(playerid, HPP[playerid], 255);
            }
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) {
    UpdateHealthTD(playerid);
    return 1;
}
Reply


Messages In This Thread
hp td - by ivndosos - 17.02.2018, 07:46
Re: hp td - by RogueDrifter - 17.02.2018, 08:01
Re: hp td - by GRiMMREAPER - 17.02.2018, 08:09
Re: hp td - by ivndosos - 17.02.2018, 08:37
Re: hp td - by GRiMMREAPER - 17.02.2018, 08:46
Re: hp td - by ivndosos - 17.02.2018, 08:51
Re: hp td - by GRiMMREAPER - 17.02.2018, 08:59
Re: hp td - by Mugala - 17.02.2018, 09:27
Re: hp td - by GRiMMREAPER - 17.02.2018, 11:20
Re: hp td - by Mugala - 17.02.2018, 11:54

Forum Jump:


Users browsing this thread: 2 Guest(s)