- Messages
- 375
- Reaction score
- 148
- Points
- 903
Not Understanding what i'm doing here that is wrong, i have had people help, but problem is still her, trying to set a maxlimit of how much health is allowed to be purchased in zombieland.. here the script
Code:
AddHealth(amount, status)
{
if (self.health <= 250 || self.health <= 100)
{
if (self.money >= level.itemPrice[status]["General"]["Health"])
{
self.addingHealth = true;
wait 0.01;
self.health += amount;
self.maxhealth = self.health;
self.addingHealth = false;
if (!self.healthMonitor)
{ self thread MonitorHealth(); }
self.money -= level.itemPrice[status]["General"]["Health"];
self iPrintln("^1+50 Health ^7Purchased Successfully");
}
else
self SendError("MoreMoney");
}
else
self SendError("MaxHealth");
}
MonitorHealth()
{
self endon("disconnect");
self endon("infected");
self endon("normalHealth");
level endon("game_ended");
self.healthMonitor = true;
for (;;)
{
if (!self.addingHealth)
{
if (self.health > 100)
self.maxhealth = self.health;
}
if (self.health < 100)
{
self.maxhealth = 100;
self.healthMonitor = false;
self notify("normalHealth");
}
wait 0.01;
}
}