Larsey123IsMe
Unregistered
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;
}
Posts: 2,169
Threads: 206
Joined: Jul 2010
Reputation:
0
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.
Posts: 2,593
Threads: 38
Joined: Aug 2007
Reputation:
0
Health is a float, and youre formatting with an integer signature, use %f
Larsey123IsMe
Unregistered
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;
}
Larsey123IsMe
Unregistered
Quote:
Originally Posted by _rAped
Index the variable.
|
Example Please =/
Larsey123IsMe
Unregistered
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...