GetPlayerHealth. - 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: GetPlayerHealth. (
/showthread.php?tid=362977)
GetPlayerHealth. -
TaLhA XIV - 26.07.2012
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.
Re: GetPlayerHealth. -
newbienoob - 26.07.2012
Use format()
pawn Код:
new str[50],Float:health;
format(str,sizeof(str),"Health: %f",GetPlayerHealth(playerid,health));
SendClientMessage(playerid,color,str);
Re: GetPlayerHealth. -
Kindred - 26.07.2012
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.
Re: GetPlayerHealth. -
[KHK]Khalid - 26.07.2012
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);
Re: GetPlayerHealth. -
Randy More - 26.07.2012
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);
Re: GetPlayerHealth. - Glint - 26.07.2012
Sorry guys, but why do you still post answers when he still got to one.