SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/01/2018, 07:03 PM   #1
wallen
Huge Clucker
 
wallen's Avatar
 
Join Date: Aug 2015
Location: Italia
Posts: 242
Reputation: 15
Default Problem with Health TD.

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.
wallen is offline   Reply With Quote
Old 24/01/2018, 07:12 PM   #2
wallen
Huge Clucker
 
wallen's Avatar
 
Join Date: Aug 2015
Location: Italia
Posts: 242
Reputation: 15
Default Re: Problem with Health TD.

id 1*
wallen is offline   Reply With Quote
Old 24/01/2018, 07:23 PM   #3
Ritzy2K
High-roller
 
Ritzy2K's Avatar
 
Join Date: Jun 2014
Location: India
Posts: 1,547
Reputation: 170
Default Re: Problem with Health TD.

Code:
TextDrawShowForPlayer
Do you use this function under OnPlayerSpawn?
__________________
Ritzy2K is offline   Reply With Quote
Old 24/01/2018, 07:24 PM   #4
severance
Big Clucker
 
Join Date: Apr 2015
Posts: 126
Reputation: 8
Default Re: Problem with Health TD.

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

Ps: second account.
severance is offline   Reply With Quote
Old 24/01/2018, 07:43 PM   #5
severance
Big Clucker
 
Join Date: Apr 2015
Posts: 126
Reputation: 8
Default Re: Problem with Health TD.

Bump
severance is offline   Reply With Quote
Old 24/01/2018, 07:56 PM   #6
PepsiCola23
Gangsta
 
Join Date: May 2015
Posts: 728
Reputation: 3
Default Re: Problem with Health TD.

Code:
new string[100];
why do you use a string that big?
PepsiCola23 is offline   Reply With Quote
Old 24/01/2018, 08:11 PM   #7
severance
Big Clucker
 
Join Date: Apr 2015
Posts: 126
Reputation: 8
Default Re: Problem with Health TD.

Yeah you right, ill fix to 10 cells.
severance is offline   Reply With Quote
Old 24/01/2018, 08:46 PM   #8
Meller
Banned
 
Join Date: Dec 2016
Posts: 578
Reputation: 132
Default Re: Problem with Health TD.

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

Meller is offline   Reply With Quote
Old 24/01/2018, 09:00 PM   #9
severance
Big Clucker
 
Join Date: Apr 2015
Posts: 126
Reputation: 8
Default Re: Problem with Health TD.

Oh lol, thanks for your fresh comment appreciated
severance is offline   Reply With Quote
Old 24/01/2018, 09:11 PM   #10
Meller
Banned
 
Join Date: Dec 2016
Posts: 578
Reputation: 132
Default Re: Problem with Health TD.

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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with health bug Lops Scripting Help 4 28/10/2013 11:34 AM
health problem Gooday Scripting Help 1 20/08/2012 12:11 AM
Problem with the Health gahal156 Scripting Help 5 02/05/2012 09:24 AM
Health Problem (little help, please) [BR]Michael Help Archive 5 27/01/2011 01:53 AM


All times are GMT. The time now is 02:50 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.