This is the code I made:
Code: Select all
void() Energy_Regen =
{
if (energy == 20)
centerprint (self, "Max energy");
return;
if (energy != 20)
{
centerprint (self, "Used some energy");
self.count = self.count + 1;
if (self.count == 20)
{
energy = 20;
}
}
};I also tried using this:
Code: Select all
void() Energy_Regen =
{
if (energy == 20)
centerprint (self, "Max energy");
return;
if (energy < 20)
{
centerprint (self, "Used some energy");
self.nextthink = time + 1;
self.think = energy + 1;
}
};Code: Select all
energy = energy - 10;Code: Select all
energy = 20;