Vice City: Multiplayer

Server Development => Scripting and Server Management => Script and Content Requests => Topic started by: [VL]BlacK.GoKu^ on Jul 19, 2017, 08:19 AM

Title: Player Health Auto Regenerate
Post by: [VL]BlacK.GoKu^ on Jul 19, 2017, 08:19 AM
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
Title: Re: Player Health Auto Regenerate
Post by: EK.IceFlake on Jul 19, 2017, 08:21 AM
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.
Title: Re: Player Health Auto Regenerate
Post by: [VL]BlacK.GoKu^ on Jul 19, 2017, 08:40 AM
@EK.IceFlake Can you please show me the Script how to do?
thanks.
Title: Re: Player Health Auto Regenerate
Post by: Terror_Styles on Jul 19, 2017, 08:55 AM
What do you mean by losing? Didn't Understand Really Will you go more briefly please?
Title: Re: Player Health Auto Regenerate
Post by: [VL]BlacK.GoKu^ on Jul 19, 2017, 09:00 AM
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
Title: Re: Player Health Auto Regenerate
Post by: Terror_Styles on Jul 19, 2017, 09:32 AM
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;
}