Player Health Auto Regenerate

Started by [VL]BlacK.GoKu^, Jul 19, 2017, 08:19 AM

Previous topic - Next topic

[VL]BlacK.GoKu^

well is there any function which can Regenerate player health after losing?? i don't want to use /heal or any other command Regeneration of health will be more better. i Hope you Understand

EK.IceFlake

Yeah, you make a routine/timer that runs every half a second or so and increases every players' health by one except if their health is 100 or more.

[VL]BlacK.GoKu^

@EK.IceFlake Can you please show me the Script how to do?
thanks.

Terror_Styles

What do you mean by losing? Didn't Understand Really Will you go more briefly please?

[VL]BlacK.GoKu^

Quote from: Terror_Styles on Jul 19, 2017, 08:55 AMWhat do you mean by losing? Didn't Understand Really Will you go more briefly please?
Like if i fall from a building and i lost -20 HP then it will auto regenerate +1hp in 2 secs

Terror_Styles

Not Tested Try..

function onPlayerHealthChange( player, lastHP, newHP )
{
     if ( player.Health < 100 )
{
MessagePlayer( "You just lost " + ( lastHP - newHP ) + " health.", player );
MessagePlayer( "Regenration random health in 5 sec", player );
NewTimer( "Healing", 5000, 1, player );
}
function Healing( player )

local num = Random(1, 4);
if ( num == 1 )
{
player.Health += 25
PrivMessage( player, "You recieve an add-on of Health Pack 25" );
}
else if ( num == 2 )
{
player.Health += 50
PrivMessage( player, "You recieve an add-on of Health Pack 50" );
}
else if ( num == 3 )
{
player.Health += 75
PrivMessage( player, "You recieve an add-on of Health Pack 75" );
}
else if ( num == 4 )
{
player.Health += 95
PrivMessage( player, "You recieve an add-on of Health Pack 95" );
}
}
function onPlayerMove( player, x1, y1, z1, x2, y2, z2 )
{
if ( player.Health > 100 )
{
player.Health = 100;
}