SA-MP Forums Archive
Hp label 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)
+--- Thread: Hp label problem (/showthread.php?tid=426399)



Hp label problem - Face9000 - 29.03.2013

So i've this code to show a textlabel with the hp/armour of the player, the problem is: it keeps saying: Hp 0 / Armour 0, why?

pawn Код:
new Float:hp, Float:am;
    GetPlayerHealth(playerid,hp);
    GetPlayerArmour(playerid,am);
    new stringk[128];
    format(stringk,sizeof(stringk),"{FFFFFF}Hp: {F70505}%0.2f {FFFFFF}- Armour: {F70505}%0.2f",hp,am);
    new Text3D:PlayerLabel = Create3DTextLabel(stringk, -1, 0.0, 0.0, 40.0, 20.0, 0, 1);
    Attach3DTextLabelToPlayer(PlayerLabel, i, 0.0, 0.0, 0.47);
I placed it on OnPlayerSpawn.


Re: Hp label problem - mrtms - 29.03.2013

Well did you print the playerid and hp variable out to see what it's giving you?


Re: Hp label problem - Joshman543 - 29.03.2013

pawn Код:
new Float:hp, Float:am;
    hp = GetPlayerHealth(playerid);
    am = GetPlayerArmour(playerid);
    new stringk[128];
    format(stringk,sizeof(stringk),"{FFFFFF}Hp: {F70505}%0.2f {FFFFFF}- Armour: {F70505}%0.2f",hp,am);
    new Text3D:PlayerLabel = Create3DTextLabel(stringk, -1, 0.0, 0.0, 40.0, 20.0, 0, 1);
    Attach3DTextLabelToPlayer(PlayerLabel, i, 0.0, 0.0, 0.47);



Re: Hp label problem - Pottus - 29.03.2013

3D Labels are unreliable and prone to bugging out when attaching, when you do get it to work expect it break when you get multiple players online (missing labels and overlapping labels) happens all the time and not recommended.