Call of Duty style damage system

For anybody who has played a Call of Duty game, you should know what I’m talking about.

It may be difficult, I don’t have a vast knowledge of lua but I am requesting a damage system in which you can take only so much damage within a certain time limit without dying.

For instance, you get shot once in the leg, an overlay flashes on the screen to indicate you are hurt, 10-15 seconds later you are fine. Get shot in the head, the script recognizes an excessive amount of damage dealt within .2 seconds thus you die.

Much like with props also, you get knocked by a prop and your pretty damaged but not dead, if the overlay is present then you can only take 5-10 more damage points until you die, where as if you get hit by a heavy object like a car or container, you get killed.

May i correct you?

the current system is

hardcore: 30 health
full health restored 5 serconds after the last hit, it doesn’t recharge like in halo, it just goes from whatever it was lets say 15, to 100 after those 5 seconds, and you hear a exhale.

normal: same as above but 100 health.

That IS how the system in COD works, those helaths, and times

Thank you for the additional information, however I was just providing examples of the damage system not actually stating the exact figures, so there is no need to “correct me”. I know the health doesn’t recharge, we already have a recharge script. If anybody could create a script similar to my request it would be much appreciated.

//Edit these values
local maxhealth = 100
local regenhealth = 2
local regendelay = 0.8
//Or edit these values ingame (Note: when you edit it ingame it’s not a permenant change, make sure you change the values above)
CreateConVar( “HealthRegen_MaxHealth”, maxhealth, { FCVAR_NONE } )
CreateConVar( “HealthRegen_RegenHealth”, regenhealth, { FCVAR_NONE } )
CreateConVar( “HealthRegen_RegenDelay”, regendelay, { FCVAR_NONE } )
CreateConVar( “HealthRegen_On”, 1, { FCVAR_NONE } )

function HeathRegen_Damage( victim, attacker )
if GetConVarNumber( “HealthRegen_On” ) == 0 then return end
local regendelay = GetConVarNumber( “HealthRegen_RegenDelay” )
victim.healthregentime = CurTime() + regendelay
victim:SetMaxHealth(maxhealth)
return true // damage the player
end
hook.Add( “PlayerShouldTakeDamage”, “HeathRegen_Damage”, HeathRegen_Damage )

function HealthRegen_Think2()
local maxhealth = GetConVarNumber( “HealthRegen_MaxHealth” )
local regenhealth = GetConVarNumber( “HealthRegen_RegenHealth” )
for i,v in pairs(player.GetAll()) do
if GetConVarNumber( “HealthRegen_On” ) == 0 then v.healthregentime = nil return end
if !v:Alive() then v.healthregentime = nil return end
if v.healthregentime then //injured
if v:Health() < maxhealth and CurTime() > v.healthregentime then //has enough time past?
v:SetHealth( v:Health() + regenhealth)
v.healthregentime = CurTime() + 1
elseif v:Health() >= maxhealth then
v:SetHealth(maxhealth)
v.healthregentime = nil //stop health regen
end
end
end
end
hook.Add(“Think”, “HealthRegen_Think2”, HealthRegen_Think2)

player.GetByID(1).healthregentime = nil
Save as Healthregen.lua place in your lua autorun folder.