health string error
#1

I made a new float called health and i made a command to display your health. When I do that command it gives me huge numbers. What shall I do ? I made the format with %i
Reply
#2

use %f beacause it's float
Reply
#3

You need to use %f to display a float in PAWN - Example below.

pawn Код:
new string[128], float:Health;
GetPlayerHealth(playerid, Health);
format(string,sizeof(string),"Your current health is %0.0f",Health);
SendClientMessage(playerid, 0xFFFFFFFF, string);
Reply
#4

pawn Код:
new string[35], Float:Health;
GetPlayerHealth(playerid, Health);
format(string, sizeof(string), "Your current health is %0.2f", Health);
SendClientMessage(playerid, -1, string);
Just a little edit of Haydz code.
Reply
#5

If i want it in a textdraw like, if he takes damage, it displays the new one.

When I made it, It gives me like 100.00000000
Reply
#6

idk what to do, really. can anyone help ?
Reply
#7

Can you show us the code you already have, we may be able to help fix it .
Reply
#8

https://sampwiki.blast.hk/wiki/Floats
https://sampwiki.blast.hk/wiki/Floats#Float_-.3E_String
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)