Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Snippet Showroom => Topic started by: NE.Restricted on August 16, 2014, 03:45:37 pm

Title: [TUTORIAL] How to make a heal system (timed)
Post by: NE.Restricted 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;
Title: Re: [TUTORIAL] How to make a heal system (timed)
Post by: [NYB]fast:p on August 21, 2014, 08:35:55 am
Go hear http://nybsr.createaforum.com/fast-showroom/heal-in-5-sec/
Title: Re: [TUTORIAL] How to make a heal system (timed)
Post by: NE.Restricted 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!