I’m trying to make it so, whenever you activate this “Feat” called “Bloodlust”, you’ll take 1 damage every second you’re out of combat, and stop when you reach 1 HP.
Now I don’t know what the problem is here but I can see its effects, I can activate this feat but whenever I activate it, no damage appears to be done any second, the game doesn’t report any errors.
If anyone can give me advice or a fix on this solution, that would be great.
function LustBlood() for k,v in pairs(player.GetAll()) do if player.GetByID(i).bloodlust == 1 && player.GetByID(i).prevAttackTime >= CurTime() && player.GetByID(i).Health > 1 then AddDamage(1) SetAttacker(player.GetByID(i)) player.GetByID(i).prevAttackTime = CurTime() + 1 end end end hook.Add("Think","LustBlood",LustBlood) function Feat_Bloodlust(ply) if ply.bloodlust != 1 then ply.prevAttackTime = CurTime() + 5 ply.bloodlust = 1 Msg(tostring(ply).." is now a bloodthirsty maniac. ") else ply.bloodlust = 0 Msg(tostring(ply).." is no longer a bloodthirsty maniac. ") end end concommand.Add("FeatsBloodlust",Feat_Bloodlust) function GetPrevDamage(ply, inflictor, attacker, amount, dmginfo) if ply.bloodlust == 1 && dmginfo:GetAttacker() != ply then ply.prevAttackTime = CurTime() + 5 // Post-pone bloodlust damage. end end hook.Add("EntityTakeDamage","GetBloodlust",GetPrevDamage)