GetPlayerHealth.
#1

Hello,
Is it possible to GetPlayerHealth and display that through SendClientMessage,Like if My health is 100 so I get a message like (Health: 100).Please help.
Reply
#2

Use format()
pawn Код:
new str[50],Float:health;
format(str,sizeof(str),"Health: %f",GetPlayerHealth(playerid,health));
SendClientMessage(playerid,color,str);
Reply
#3

EDIT: To late, why am I last these days!

pawn Код:
new Float:Health, string[20];
GetPlayerHealth(playerid,Health);
format(string, sizeof(string), "Health: %f", Health);
SendClientMessage(playerid, -1, string);
Search before asking next time.

Simply gets the players health, stores it in a variable, formats a string with the Health value, and sends it to the player.
Reply
#4

That's really basic. Yes, you can do that using Format:

pawn Код:
new Float:health; // a float variable to store the health in
new str[32]; // a string to hold the message. Consider the length
GetPlayerHealth(playerid, health); // get's the player helath and store it into the variable health
format(str, sizeof(str), "Health: %.1f", health);
SendClientMessage(playerid, -1, str);
Reply
#5

This is to have it clearly like that "100".

pawn Код:
new Float: HP, formatstring[40];
GetPlayerHealth(playerid, HP);
format(formatstring, sizeof(formattstring),"INFO: Your current health points are %0f.", HP);
SendClientMessage(playerid, SOME_COLOR, formatstring);
Reply
#6

Sorry guys, but why do you still post answers when he still got to one.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)