All it does is when a player takes damage, it only adds 1 health, it doesn't regenerate no matter what health the player has.
Here's the code:
package HealthBar
{
function gameConnection::onClientEnterGame(%this)
{
parent::onClientEnterGame(%this);
%this.HealthRegenerationBar();
}
function gameConnection::onClientLeaveGame(%this)
{
cancel(%this.HealthRegenerationBar);
parent::onClientLeaveGame(%this);
}
};
activatepackage(HealthBar);
package HealthRegeneration
{
function Player::Damage(%this, %projectile, %position, %damage, %type)
{
parent::damage(%this, %projectile, %position, %damage, %type);
%this.HealthRegenerationBar();
}
};
activatepackage(HealthRegeneration);
function gameConnection::HealthRegenerationBar(%this)
{
%health = %this.player.getDatablock().maxDamage - %this.player.getDamageLevel();
if(%health <= 99 && %health >= 60)
{
%health += 1;
}
else
if(%health <= 59 && %health >= 20)
{
%health += 0.8;
}
else
if(%health <= 19)
{
%health += 0.5;
}
commandToClient(%this,'BottomPrint',"Health: "@%health);
%this.schedule(200,"HealthRegenerationBar");
}
As you can see, I'm not a good coder.