Healing over time effect[HELP]
#1

Hello everybody, I know this might a bit too much to ask for but i'm looking to create a heal over time effect.

So upon typing /pills 5 the player would get a healing effect that healers the player for 3 hp every 1 second and for a total of 30 seconds. And then upon taking /pills 10 the (TIME) would double, not the effect, only the time so It would last for a minute.

Upon spawning a player should have 500 pills. And this resets after death.

I will surely give a helper REP UP! If you cannot create the script, maybe you can provide some guidelines.

Any help is apprecciated, regards Eemale!
Reply
#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
#3

Under the public
Код:
public HealSlowly( playerid )
{
      new health_;
      GetPlayerHealth( playerid, health_ );
      if( health_ > 100) { KillTimer( healer_timer[ playerid ] ); healer_timer[ playerid ] = INVALID_TIMER; }
      Else SetPlayerHealth( playerid, health_ + 1 );
      return 1;
}
There should be new Float:health_; btw

Anyways this seems working but the problem is that this wont last 30 seconds, it lasts untill my hp gets up to 100.
Thanks a bunch, Repped but could you help me out with thisone?
Reply
#4

Also is there a way to do this.
Код:
ApplyAnimation(playerid,"SMOKING","M_smk_in",4.2,0,0,0,0,0,1);
So that upon pressing ENTER, it kills the animation halfway through.

Thanks in advance.
Reply
#5

bump
Reply
#6

Use a SetTimerEx that will heal you every * seconds you want and every * amount of health. Also while it is healing you. Make it apply the animation to the player "SMOKING". Hope this helps.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)