One way to be healed

Started by Diego^, May 12, 2015, 08:00 PM

Previous topic - Next topic

Diego^

function onScriptLoad()
{
H <- BindKey(true,0x48,0,0);
Heal <- array( GetMaxPlayers(), false );
NewTimer("Key_Pressing" , 1000, 0 );
}
function onKeyDown( player, bindid )
{
        switch(bindid)
        {
        case H:
                if ( player.IsSpawned && player.Health < 100 )
            {
                    Heal[ player.ID ] = true;
                    MessagePlayer("To be healed totally not release the H button...", player );
                    }
        break;
        }
}
function onKeyUp( player, bindid )
{
switch(bindid)
        {
       case H:
       Heal[ player.ID ] = false;
       if( player.Health < 100 ) MessagePlayer("INFO: You must hold to be fully healed.", player );
       break;
        }
}
function Key_Pressing()
{
if ( GetPlayers() >= 1 )
{
        for ( local i = 0; i < GetMaxPlayers(); i++ )
        {
                local player = FindPlayer( i );
                if ( player )
                {
                        if ( player.IsSpawned )
                        {
                  if ( Heal[ player.ID ] == true )
                  {
                  if ( player.Health == 100 ) 
                 {
                 Heal[ player.ID ] = false;
                 MessagePlayer("You were completely healed!", player );
                 }
                 else player.Health ++; //You can edit!
                  }
}
}
}
}
}
function onPlayerPart( player, reason )
{
if ( Heal[ player.ID ] == true ) Heal[ player.ID ] = false;
}
BRL's Developer.

Sebastian

I would specify zones where you can heal; otherwise, you would just be able to heal while you are attacked. :)
But this ofc, is just a base, an original idea that should be improved by us, to make our servers more unique.

I like it, it reminds me about Half Life game where you were needed to keep down the E button to heal, near the Life Charger. :D