I’m in the process of writing a cakescript mod. Basically, I want to create a bit of code that infects the character and does damage, but can be stopped by using an item. My problem is that when I try to loop the damage using a repeat loop, it comes up with an infinite loop error in the console after fps lagging like a bitch. I need help to get it sorted!
[lua]function GM:PlayerHurt( victim, attacker )
local infectchance = math.random (1,5)
infected = 0
if attacker:IsNPC() then
if infectchance == 1 then
infected = 1
repeat
timer.Create(“infection”, 6, 1, Infection)
until (infected == 0)
end
end
end
function Infection()
ply:Takedamage(1)
end[/lua]
Thanks in advance.
Todrak