CreateConVar( "gc_realheadcrabs", 1, SERVER_CAN_EXECUTE, "Headcrabs have a chance to kill you instantly." ) function HeadcrabDeath(ply,headcrab) ply:ConCommand("pp_mat_overlay halflife/black") ply:ConCommand("play npc/headcrab_poison/ph_poisonbite1.wav") headcrab:Remove() timer.Simple(1,function() if(ply:IsValid()) then ply:ConCommand("pp_mat_overlay [[]]") end end ) end hook.Add( "PlayerHurt", "HeadcrabHurtFunction", function( victim, attacker, healthRemaining, damageTaken ) if((GetConVarNumber( "gc_realheadcrabs" ) != 0) || forcerealisticheadcrabs) then if(attacker:GetClass() == "npc_headcrab_fast") then if((damageTaken + 25) >= healthRemaining) then HeadcrabDeath(victim,attacker) end victim:SetHealth(healthRemaining - 25) end if(attacker:GetClass() == "npc_headcrab") then if((damageTaken + 40) >= healthRemaining) then HeadcrabDeath(victim,attacker) end victim:SetHealth(healthRemaining - 40) end if(attacker:GetClass() == "npc_headcrab_black") then HeadcrabDeath(victim,attacker) victim:SetHealth(0) end if(attacker:GetClass() == "npc_headcrab_poison") then HeadcrabDeath(victim,attacker) victim:SetHealth(0) end end end)