SA-MP Forums Archive
HP Textdraw 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 Textdraw Problem (/showthread.php?tid=434957)



HP Textdraw Problem - K3VIN - 04.05.2013

Hey guys,

i have a problem with my TextDraw, i would show the HP for the Player... here is my
Problem. The Problem is, that the number is not the Original Number of the Player and it bugs.

Code:

Код:
new Text:HP1[MAX_PLAYERS];

for(new i=0; i<MAX_PLAYERS; i++)
{
		HP1[i] = TextDrawCreate(558.000000,67.000000,"100%");
		TextDrawSetOutline(HP1[i],1);
		TextDrawLetterSize(HP1[i],0.2000000,0.800000);
		TextDrawAlignment(HP1[i],0);
		TextDrawSetShadow(HP1[i],0);
		TextDrawSetProportional(HP1[i],1);
}

OnPlayerUpdate...

for(new i=0; i<MAX_PLAYERS; i++)
{
  		new Float: hp;
		GetPlayerHealth(i, hp);
		format(mstr,sizeof(mstr),"% .0f hp",hp);
		TextDrawSetString(HP1[i],mstr);
}
Sri for my bad English im From Germany


Re: HP Textdraw Problem - XStormiest - 04.05.2013

i just have a question, if you wanted to make that for a single player, why did you looped it and maked it for all players?
Код:
new Float: hp;
		GetPlayerHealth(playerid, hp);
		format(mstr,sizeof(mstr),"% .0f hp",hp);
		TextDrawSetString(HP1[playerid],mstr);
This must be like this if you want for that to work


AW: HP Textdraw Problem - K3VIN - 04.05.2013

Yeah sri, i was just a little bit confused
But it works now..