Blockland Forums > Modification Help

What is the statement for getting the target's HP?

Pages: (1/1)

Minnax:

Question in the title.

CityRPG:


--- Code: ---function serverCmdMyHP(%client)
{
%obj = %client.player;

if(isObject(%obj))
{
%damage = %obj.getDamageLevel();
%maxHP = %obj.getDatablock().maxDamage;
%health = mFloor(%maxHP - %damage);
%per = mFloor((1 - %obj.getDamagePercent()) * 100);

messageClient(%client, '', "\c6You are at \c3" @ %per @ "5\c6 HP, with \c3" @ %health @ "\c6 HP remaining.");
}
}
--- End code ---

Should work.

There's no function to get just health. You can get damage, and you can find their max damage level.

Pages: (1/1)

Go to full version