Author Topic: [TUTORIAL] How to make a heal system (timed)  (Read 2456 times)

0 Members and 1 Guest are viewing this topic.

Offline NE.Restricted

  • Wiseguy
  • **
  • Posts: 97
    • View Profile
[TUTORIAL] How to make a heal system (timed)
« on: August 16, 2014, 03:45:37 pm »
In pawn, you cannot pass arguments using a timer.
Or can you!
To make a timed heal system requires some variables:
Code: [Select]
new IsHealing[100];
new HealCount[100];
Some definitions
Code: [Select]
#define HEAL_HEALTH_AMOUNT 100 //the amount of heal you wanna give after healing
#define HEAL_TIME_SECONDS 10 //the time you want to take to heal in seconds
And a timer, ofcourse
Code: [Select]
public OnGameModeInit()
{
NewTimer("Healed", 1000, 1);
}
And the timed function
Code: [Select]
public Healed()
{
for(new i; i<=100; i++)
{
if(IsHealing[i]==1)
{
HealCount[i]++;
if(HealCount[i]== HEAL_TIME_SECONDS)
{
IsHealing[i] = 0;
SetPlayerHealth(i, HEAL_HEALTH_AMOUNT);
}
}
}
}
and where you want to make the heal (example !heal)
Code: [Select]
IsHealing[playerid] = 1;
HealCount[playerid] = 0;
I am NE.CrystalBlue!!!
Quote
i cant able to understand

Offline [NYB]fast:p

  • Street Thug
  • *
  • Posts: 28
    • View Profile

Offline NE.Restricted

  • Wiseguy
  • **
  • Posts: 97
    • View Profile
Re: [TUTORIAL] How to make a heal system (timed)
« Reply #2 on: August 23, 2014, 05:38:31 pm »
Go hear http://nybsr.createaforum.com/fast-showroom/heal-in-5-sec/
Bugged!
This will healed ID 0 while the player wrote !heal wonder why he frozen and frozen and not unfreeze!
I am NE.CrystalBlue!!!
Quote
i cant able to understand