Healing over time effect[HELP]
#2

1) Create a public function to increase the player health by 1/3/w/e you want
2) Set a timer in the command
eg

pawn Код:
#define INVALID_TIMER -24
healer_timer[ MAX_PLAYERS ] = INVALID_TIMER;
forward public HealSlowly( playerid );


CMD:heal_me_over_time(playerid)
{
    healer_timer[ playerid ] = SetTimerEx("HealSlowly", 1000, 1, "d", playerid);
    return 1;
}

public HealSlowly( playerid )
{
      new Float: health_;
      GetPlayerHealth( playerid, health_ );
      if( health_ > 100) { KillTimer( healer_timer[ playerid ] ); healer_timer[ playerid ] = INVALID_TIMER; }
      Else SetPlayerHealth( playerid, health_ + 1 );
      return 1;
}

public OnPlayerDisconnect( playerid ..)
{
   healer_timer[ playerid ] = INVALID_TIMER;
   return 1;
}
Reply


Messages In This Thread
Healing over time effect[HELP] - by eemalekorraks - 23.08.2013, 12:41
Re: Healing over time effect[HELP] - by RajatPawar - 23.08.2013, 12:45
Re: Healing over time effect[HELP] - by eemalekorraks - 23.08.2013, 13:27
Re: Healing over time effect[HELP] - by eemalekorraks - 23.08.2013, 13:46
Re: Healing over time effect[HELP] - by eemalekorraks - 24.08.2013, 14:05
Re: Healing over time effect[HELP] - by xXSPRITEXx - 24.08.2013, 14:13

Forum Jump:


Users browsing this thread: 1 Guest(s)