Thank you for your replies earlier
I managed to get my own images shown instead of the default hearts. Although, we've decided to use a health bar instead of just images.
But I'm not really a fan of the onTimeout function used. Feels like it could be done without a timer running constantly?
Isn't there any event that handels onPlayerHurt or do I need to write such an event by myself?
Here's the code we use:
PHP Code:
//#CLIENTSIDE
function onCreated()
{
new GuiControlProfile("TextProfile")
{
fontcolor = "0 0 0";
fonttype = "Arial";
fontsize = 25;
fontstyle = "b";
}
new GuiProgressCtrl("HealthControl_Bar")
{
profile = GuiBlueProgressProfile;
width = 360;
height = 40;
x = screenwidth - width - 20;
y = 10;
progress = player.hearts/player.fullhearts;
new GuiTextCtrl("HealthConrol_Text")
{
profile = TextProfile;
x = HealthControl_Bar.width / 2 - this.width / 2;
y = 10;
height = 20;
width = 80;
text = player.hearts SPC "/" SPC player.fullhearts;
}
}
onTimeout();
}
function onTimeout()
{
HealthControl_Bar = player.hearts/player.fullhearts;
HealthControl_Text.text = player.hearts SPC "/" SPC player.fullhearts;
setTimer(0.5);
}