commit e19094ff6537ac14132c5bd7358876ce9a3a68fc Author: Fierelier Date: Tue Apr 17 21:16:20 2018 +0200 First Commit diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..1ca9b08 Binary files /dev/null and b/logo.png differ diff --git a/paydayHealth.cs b/paydayHealth.cs new file mode 100644 index 0000000..185a863 --- /dev/null +++ b/paydayHealth.cs @@ -0,0 +1,75 @@ +using System; +using System.Windows.Forms; +using GTA; + +namespace pdHealth +{ + public class pdHealth : Script + { + + public pdHealth() + { + this.Tick += new EventHandler(this.doHealthTick); + //this.KeyDown += new GTA.KeyEventHandler(this.keyDownHandler); + } + + //Settings: + int tickTime = 100; //Tick-Rate in ms + int armorRegen = 25; //How far to regenerate the armor + int armorRegenSpeed = 1; //How much armor to regenerate per tick + int armorRegenDelay = 5000; //Delay before recharging armor + + //Vars + int armorVal = -1; + int healthVal = -1; + int timeUntilRegen = 0; + + private void doHealthTick(object sender, EventArgs e) + { + Ped pl = Player.Character; + + if (pl.Armor < armorVal) { timeUntilRegen = armorRegenDelay; } + if (pl.Health < healthVal) { timeUntilRegen = armorRegenDelay; } + + if (pl.isAlive == false) { + armorVal = -1; + healthVal = -1; + timeUntilRegen = 0; + return; + } + + if (timeUntilRegen > 0) { + timeUntilRegen = timeUntilRegen - tickTime; + if (timeUntilRegen < 0) { timeUntilRegen = 0; } + } else { + if (pl.Armor < armorRegen) { + pl.Armor = pl.Armor + armorRegenSpeed; + if (pl.Armor > armorRegen) { pl.Armor = armorRegen; } + } + } + + armorVal = pl.Armor; + healthVal = pl.Health; + Game.DisplayText("Health:\n " +pl.Health.ToString(), 1000); + Wait(tickTime); + } + + //Testing + private void keyDownHandler(object sender, GTA.KeyEventArgs e) + { + if (e.Key == Keys.B) { + Ped pl = Player.Character; + pl.Invincible = true; + pl.Health = -1; + return; + } + + if (e.Key == Keys.N) { + Ped pl = Player.Character; + pl.Invincible = false; + pl.Health = -100; + return; + } + } + } +} \ No newline at end of file