Posts: 403
Threads: 88
Joined: Sep 2014
Reputation:
0
Hi,
So, I have an HP Textdraw
It's always green but I was wondering how do I change the colors by detecting the HP value? For example I'd say... If the TD is HP: 50 then the colour of the TD will change to orange?
Keep in mind that I already have a TD, I was wondering if you can give me an detailed explanation on how to do so?
If you need the code I'll gladly show it if you need something to show it on.
Posts: 1,176
Threads: 2
Joined: Nov 2012
Reputation:
0
is it PlayerTextDraw? if not just change it to PlayerTextDraw.
you have to change this textdraw's color with PlayerTextDrawColor and must hide and re-show when player Takes damages (OnPlayerTakeDamage)
Posts: 1,176
Threads: 2
Joined: Nov 2012
Reputation:
0
change the whole code to PlayerTextDraws
Posts: 1,547
Threads: 122
Joined: Jun 2014
Reputation:
0
Uh, Mugala got the first step for you. You need Player Textdraw because each player will have their own unique float value of HP. Secondly, you can either check for the HP under OnPlayerUpdate or make a timer and start it off when a player spawns, then depending on the HP of player you can set the color.
Posts: 6,242
Threads: 8
Joined: Jun 2008
Quote:
Originally Posted by ivndosos
I've done that and I got tag mismatch on all of the lines
|
Because you now have
PHP код:
new Text:Bladebla[MAX_PLAYERS]
instead of
PHP код:
new PlayerText:Bladebla[MAX_PLAYERS]
This is usually what tag mismatches refer to... When you use a string in an integer value, or a float in an integer.
Posts: 403
Threads: 88
Joined: Sep 2014
Reputation:
0
Okay, I've done that, no errors whatsoever.
How do I continue now? OnPlayerUpdate? OnPlayerDamage? Mind showing me a quick example with a code so I just know how? with explanations please
Posts: 6,242
Threads: 8
Joined: Jun 2008
There will be tutorials on things 'close' to this. (More on injury systems that watch for the health changes)
You can choose to either do the 'update' through OnPlayerGive/TakeDamage, or through a timer.
OnPlayerUpdate is very easily overloaded, and will end up causing trouble with the script being bogged down.
I myself prefer timers, as they are simple.