Author Topic: What is the statement for getting the target's HP?  (Read 581 times)

Question in the title.

Code: [Select]
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.");
}
}

Should work.

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