Know how Much Health Player Have? -
ServerScripter - 04.09.2011
Hi , i want to know how to Creat like a text in the Top of the Screen say that :
Health : TheHealthOfPlayer
thanx
Re: Know how Much Health Player Have? -
Darnell - 04.09.2011
Create3DTextLabel, Attach3DTextLabelToPlayer, Update3DTextLabelText.
Re: Know how Much Health Player Have? -
[MWR]Blood - 04.09.2011
Use GetPlayerHealth:
https://sampwiki.blast.hk/wiki/GetPlayerHealth
Then, create a textdraw, create a public function where you will set the textdraw's string, finally do a timer that will call that function
Example:
pawn Код:
new Text:Textdraw;
//under OnGameModeInit
SetTimer("UpdateHealth",3000,true);//setting up the timer that will call the function
//Your textdraw create code here..
//under OnPlayerSpawn
TextDrawShowForPlayer(playerid,Textdraw);
//anywhere in your gamemode(not in any callback)
forward UpdateHealth(playerid);
public UpdateHealth(playerid)
{
new Float:health, string[20];
GetPlayerHealth(playerid,health);
format(string,sizeof(string),"Health: %03f",health);
TextDrawSetString(Textdraw,string);
return 1;
}
Re: Know how Much Health Player Have? -
Phanto90 - 04.09.2011
Or maybe a textdraw. He hasn't been very much descriptive D:
Re: Know how Much Health Player Have? -
Hellhound - 04.09.2011
Use new Float:X,Float:Y Etc...
Then GetPlayerPos(playerid, X,Y,Z)
and Format it.... format(Var, sizeof(Var) " <Text> %f %f %f", X,Y,Z);
Then GameTextForPlayer(playerid, Var, 5000, 1);
Re: Know how Much Health Player Have? -
ServerScripter - 04.09.2011
Quote:
Originally Posted by [MWR]Blood
Use GetPlayerHealth:
https://sampwiki.blast.hk/wiki/GetPlayerHealth
Then, create a textdraw, create a public function where you will set the textdraw's string, finally do a timer that will call that function
Example:
pawn Код:
new Text:Textdraw;
//under OnGameModeInit SetTimer("UpdateHealth",3000,true);//setting up the timer that will call the function //Your textdraw create code here..
//under OnPlayerSpawn TextDrawShowForPlayer(playerid,Textdraw);
//anywhere in your gamemode(not in any callback) forward UpdateHealth(playerid); public UpdateHealth(playerid) { new Float:health, string[20]; GetPlayerHealth(playerid,health); format(string,sizeof(string),"Health: %03f",health); TextDrawSetString(Textdraw,string); return 1; }
|
Your Code is without Warnings/Errors
but Don't Working i can't see My health IG...
Re: Know how Much Health Player Have? -
[MWR]Blood - 04.09.2011
Well, are you sure you created your textdraw, and the names are exactly the same everywhere?
Re: Know how Much Health Player Have? -
Darnell - 04.09.2011
Quote:
Originally Posted by ServerScripter
Your Code is without Warnings/Errors
but Don't Working i can't see My health IG...
|
You won't see YOUR OWN health, other players will see it above you.
Re: Know how Much Health Player Have? -
ServerScripter - 04.09.2011
I folowed all you sayed step by step,
and to explain more, i want all players see their Health .
Re: Know how Much Health Player Have? -
[MWR]Blood - 04.09.2011
Quote:
Originally Posted by Darnell
You won't see YOUR OWN health, other players will see it above you.
|
He should be able to see his health as I made it in a textdraw.
@ServerScripter: Are you sure your textdraw isn't created somewhere out of the screen?
What tool did you use to create it?