Problem with Health TD.
#1

Top:

Code:
new Text:HPP[MAX_PLAYERS];
OnGameModeInit

Code:
	
  	for(new i = 0; i < MAX_PLAYERS; i++)
    {
 	HPP[i] = TextDrawCreate(8.000000, 430.000000, "_");
	TextDrawBackgroundColor(HPP[i], 16711935);
	TextDrawFont(HPP[i], 3);
	TextDrawLetterSize(HPP[i], 0.700000, 1.800000);
	TextDrawColor(HPP[i], 712256255);
	TextDrawSetOutline(HPP[i], 1);
	TextDrawSetProportional(HPP[i], 1);
	}
end:

Code:
forward hp(playerid);
public hp(playerid)
{
    new string[100];
    new Float:pHealth;
    GetPlayerHealth(playerid,pHealth);
    format(string, sizeof(string), "hp: %.0f", pHealth);
    TextDrawSetString(HPP[playerid], string);
}
I don't understand, when i tested it with 2 guys, the id 0 has all the textdraws including HP (which shows correctly fine), but me as id 2, doesnt see the HP td, which is actually weird and i dont know what to do.
Probably something regarding on forward and public hp lines, just cant find the problem, help me please.
Reply
#2

id 1*
Reply
#3

Code:
TextDrawShowForPlayer
Do you use this function under OnPlayerSpawn?
Reply
#4

Yeah.. I used TextDrawShowForPlayer(playerid, HPP[playerid);

Ps: second account.
Reply
#5

Bump
Reply
#6

Code:
new string[100];
why do you use a string that big?
Reply
#7

Yeah you right, ill fix to 10 cells.
Reply
#8

PHP Code:
forward hp(playerid);
public 
hp(playerid)
{
    new 
string[8], Float:pHealth;
    
GetPlayerHealth(playeridpHealth);
    
format(stringsizeof(string), "hp: %.0f"pHealth);
    
TextDrawSetString(HPP[playerid], string);
    
TextDrawShowForPlayer(playeridHPP[playerid]);

Reply
#9

Oh lol, thanks for your fresh comment appreciated
Reply
#10

Quote:
Originally Posted by severance
View Post
Oh lol, thanks for your fresh comment appreciated
always.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)