SA-MP Forums Archive
Problem with Health TD. - 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: Problem with Health TD. (/showthread.php?tid=648568)



Problem with Health TD. - wallen - 24.01.2018

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.


Re: Problem with Health TD. - wallen - 24.01.2018

id 1*


Re: Problem with Health TD. - Ritzy2K - 24.01.2018

Code:
TextDrawShowForPlayer
Do you use this function under OnPlayerSpawn?


Re: Problem with Health TD. - severance - 24.01.2018

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

Ps: second account.


Re: Problem with Health TD. - severance - 24.01.2018

Bump


Re: Problem with Health TD. - PepsiCola23 - 24.01.2018

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


Re: Problem with Health TD. - severance - 24.01.2018

Yeah you right, ill fix to 10 cells.


Re: Problem with Health TD. - Meller - 24.01.2018

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]);




Re: Problem with Health TD. - severance - 24.01.2018

Oh lol, thanks for your fresh comment appreciated


Re: Problem with Health TD. - Meller - 24.01.2018

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