Revert "Broke af"

This reverts commit 87cab524ee.
This commit is contained in:
Fierelier 2018-04-17 22:59:02 +02:00
parent 87cab524ee
commit 809672d61a

View File

@ -6,9 +6,9 @@ namespace pdHealth
{ {
public class pdHealth : Script public class pdHealth : Script
{ {
public pdHealth() public pdHealth()
{ {
if (allDamageArmor == true) { this.Tick += new EventHandler(this.doAllDamageArmorTick); }
this.Tick += new EventHandler(this.doHealthTick); this.Tick += new EventHandler(this.doHealthTick);
//this.KeyDown += new GTA.KeyEventHandler(this.keyDownHandler); //this.KeyDown += new GTA.KeyEventHandler(this.keyDownHandler);
} }
@ -40,30 +40,7 @@ namespace pdHealth
if (pl.Armor < armorVal) { timeUntilRegen = armorRegenDelay; } if (pl.Armor < armorVal) { timeUntilRegen = armorRegenDelay; }
if (pl.Health < healthVal) { timeUntilRegen = armorRegenDelay; } if (pl.Health < healthVal) { timeUntilRegen = armorRegenDelay; }
if (timeUntilRegen > 0) { if (allDamageArmor == true) {
timeUntilRegen = timeUntilRegen - tickTime;
if (timeUntilRegen < 0) { timeUntilRegen = 0; }
}
if (timeUntilRegen == 0) {
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: " +pl.Health.ToString()+ "\nArmor: " +pl.Armor.ToString(), 1000);
Wait(tickTime);
}
private void doAllDamageArmorTick(object sender, EventArgs e)
{
Ped pl = Player.Character;
if (pl.isAlive == false) { return; }
if (pl.Health < healthVal) { if (pl.Health < healthVal) {
int damageTaken = healthVal - pl.Health; int damageTaken = healthVal - pl.Health;
if (damageTaken < pl.Armor) { if (damageTaken < pl.Armor) {
@ -74,9 +51,22 @@ namespace pdHealth
pl.Armor = 0; pl.Armor = 0;
} }
} }
}
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; armorVal = pl.Armor;
healthVal = pl.Health; healthVal = pl.Health;
Game.DisplayText("Health:\n " +pl.Health.ToString(), 1000);
Wait(tickTime);
} }
//Testing //Testing