17.01.2018, 15:24
Using a loop is quite unnecessary in this case. This is all you need to do:
Put this on top of your script under other variables:
OnPlayerConnect:
OnPlayerSpawn:
OnPlayerUpdate or any other looped player timer:
Put this on top of your script under other variables:
Код:
new PlayerText:Health[MAX_PLAYERS];
Код:
Health[playerid] = CreatePlayerTextDraw(playerid, 8.000000, 430.000000, "HP 100%"); PlayerTextDrawBackgroundColor(playerid, Health[playerid], 16711935); PlayerTextDrawFont(playerid, Health[playerid], 3); PlayerTextDrawLetterSize(playerid, Health[playerid], 0.700000, 1.800000); PlayerTextDrawColor(playerid, Health[playerid], 712256255); PlayerTextDrawSetOutline(playerid, Health[playerid], 1); PlayerTextDrawSetProportional(playerid, Health[playerid], 1); PlayerTextDrawHide(playerid, Health[playerid]); // hide the textdraw
Код:
PlayerTextDrawShow(playerid, Health[playerid]); // show the textdraw
Код:
new String[32], Float:hp; GetPlayerHealth(playerid, hp); format(String, sizeof(String), "HP: %0.1f", hp); PlayerTextDrawSetString(playerid, Health[playerid], String);

