[HELP] Health TextDraw? - Larsey123IsMe - 09.01.2011
Why this dont work? it gives me random numbers on my TextDraw, like: 145614251456
pawn Code:
public OnPlayerUpdate(playerid)
{
new string[128];
new Float:health;
GetPlayerHealth(playerid, health);
format(string, sizeof(string), "%i", health);
TextDrawSetString(HealthTD, string);
return 1;
}
Re: [HELP] Health TextDraw? -
Kitten - 09.01.2011
try making in a stock or a public and a timer for idk 5 sec? i had this problem with checking player health i tryed that it worked.
EDIT: Oops.
Re: [HELP] Health TextDraw? -
Joe Staff - 09.01.2011
Health is a float, and youre formatting with an integer signature, use %f
Re: [HELP] Health TextDraw? -
MrDeath537 - 09.01.2011
Quote:
Originally Posted by SilentHuntR
Health is a float, and youre formatting with an integer signature, use %f
|
Yesh, and then use TextDrawShowForPlayer.
Re: [HELP] Health TextDraw? -
Joe Staff - 09.01.2011
Quote:
Originally Posted by MrDeath
Yesh, and then use TextDrawShowForPlayer.
|
Not neccesaary, TextDrawSetString is the only textdraw function that updates itself, very annoying
Re: [HELP] Health TextDraw? - Larsey123IsMe - 09.01.2011
Well? Im empty xD Here is the code:
pawn Code:
#include <a_samp>
new Text:HealthTD;
public OnFilterScriptInit()
{
HealthTD = TextDrawCreate(251.000000, 434.000000, "-");
TextDrawBackgroundColor(HealthTD, 255);
TextDrawFont(HealthTD, 1);
TextDrawLetterSize(HealthTD, 0.500000, 1.000000);
TextDrawColor(HealthTD, -1);
TextDrawSetOutline(HealthTD, 0);
TextDrawSetProportional(HealthTD, 1);
TextDrawSetShadow(HealthTD, 1);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/show", cmdtext, true, 10) == 0)
{
TextDrawShowForPlayer(playerid,HealthTD);
return 1;
}
if (strcmp("/hide", cmdtext, true, 10) == 0)
{
TextDrawHideForPlayer(playerid,HealthTD);
return 1;
}
return 0;
}
public OnPlayerUpdate(playerid)
{
new string[128];
new Float:health;
GetPlayerHealth(playerid, health);
format(string, sizeof(string), "%f", health);
TextDrawSetString(HealthTD, string);
return 1;
}
Re: [HELP] Health TextDraw? -
_rAped - 09.01.2011
Index the variable.
Re: [HELP] Health TextDraw? - Larsey123IsMe - 09.01.2011
Quote:
Originally Posted by _rAped
Index the variable.
|
Example Please =/
Re: [HELP] Health TextDraw? -
Zamaroht - 09.01.2011
Quote:
Originally Posted by SilentHuntR
Health is a float, and youre formatting with an integer signature, use %f
|
Do as he said, use %f instead of %i.
Re: [HELP] Health TextDraw? - Larsey123IsMe - 09.01.2011
Quote:
Originally Posted by Zamaroht
Do as he said, use %f instead of %i.
|
I did like he said, i canged from %i to %f
But then i get on my TextDraw: 15.000000 = Full health
And i want it like
Full Health = 100
ect...