add sborka

This commit is contained in:
2026-03-31 10:27:04 +03:00
commit f5e5f56c84
2345 changed files with 382127 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
local meta = FindMetaTable( "Player" )
function meta:IsBleeding()
return self:GetNWBool("Bleeding") or false
end
function meta:GetHeartAttack()
return self:GetNWBool("HeartAttack") or false
end
function meta:IsPoisoned()
return self:GetNWBool("Poisoned") or false
end
function meta:GetMedicAnimation()
return self:GetNWInt("MedicActivity") or 0
end
function meta:IsMorphine()
return self:GetNWBool("Morphine") or false
end
function meta:IsFractured()
return self:GetNWBool("Fracture") or false
end
function meta:Stable()
if self:IsPoisoned() or self:GetHeartAttack() or self:IsBleeding() then
return false
else
return true
end
end
local ent = FindMetaTable( "Entity" )
function ent:IsDeathRagdoll()
return self:GetNWBool("IsDeathRagdoll") or false
end

View File

@@ -0,0 +1,114 @@
local sentences =ConfigurationMedicMod.Sentences
local lang = ConfigurationMedicMod.Language
-- Play animations
hook.Add("CalcMainActivity", "CalcMainActivity.MedicMod", function(ply, vel)
if ply:GetMedicAnimation() == 1 then
local seqid = ply:LookupSequence( "medic_custom1" )
ply:SetSequence( seqid )
return -1, seqid
end
if ply:GetMedicAnimation() == 2 then
-- stop the animation if the ragdoll isn't near the player
if not ply:GetEyeTrace().Entity:IsDeathRagdoll() or ply:GetEyeTrace().Entity:GetPos():Distance(ply:GetPos()) > 100 then
if SERVER then
if IsValid( ply.RagdollHeartMassage ) && IsValid( ply.RagdollHeartMassage:GetOwner() ) then
ply.RagdollHeartMassage:GetOwner().NextSpawnTime = CurTime() + ply.RagdollHeartMassage:GetOwner().AddToSpawnTime
ply.RagdollHeartMassage.IsHeartMassage = false
net.Start("MedicMod.Respawn")
net.WriteInt(ply.RagdollHeartMassage:GetOwner().NextSpawnTime,32)
net.Send(ply)
end
ply:StripWeapon("heart_massage")
end
if SERVER then StopMedicAnimation( ply ) end
return
end
local seqid = ply:LookupSequence( "medic_custom2" )
ply:SetSequence( seqid )
return -1, seqid
end
end)
hook.Add("PlayerButtonUp", "PlayerButtonUp.MedicMod", function( ply, but )
if table.HasValue( ConfigurationMedicMod.TeamsCantPracticeCPR, ply:Team() ) then return end
if but != ConfigurationMedicMod.CPRKey or not ConfigurationMedicMod.CanCPR then return end
if ply.blocAnim && ply.blocAnim >= CurTime() then return end
-- if the player press the configured key, then stop his animation
if ply:GetMedicAnimation() != 0 then
if SERVER then
-- add condition pour si le mec n'a plus d'arrêt cardiaque
if IsValid( ply.RagdollHeartMassage ) && IsValid( ply.RagdollHeartMassage:GetOwner() ) then
ply.RagdollHeartMassage:GetOwner().NextSpawnTime = CurTime() + ply.RagdollHeartMassage:GetOwner().AddToSpawnTime
ply.RagdollHeartMassage.IsHeartMassage = false
net.Start("MedicMod.Respawn")
net.WriteInt(ply.RagdollHeartMassage:GetOwner().NextSpawnTime,32)
net.Send(ply.RagdollHeartMassage:GetOwner())
end
ply:StripWeapon("heart_massage")
end
ply.blocAnim = CurTime() + 2
if SERVER then StopMedicAnimation( ply ) end
return
end
local trace = ply:GetEyeTrace()
local ent = trace.Entity
if not IsValid(ent) then return end
if ent.IsHeartMassage then return end
if not ent:IsDeathRagdoll() or ent:GetClass() == "prop_physics" or trace.HitPos:Distance(ply:GetPos()) > 100 then return end
if table.HasValue( ConfigurationMedicMod.TeamsCantReceiveCPR, ent:GetOwner():Team() ) then return end
if ent:GetOwner().NextSpawnTime == -1 then return end
ply.RagdollHeartMassage = ent
ent.IsHeartMassage = true
if SERVER then StartMedicAnimation( ply, 1 ) end
ply.blocAnim = CurTime() + 5
timer.Simple(2.7, function()
if SERVER then
ply:Give("heart_massage")
ply:SelectWeapon("heart_massage")
ply:MedicNotif( sentences["You are starting CPR"][lang], 10)
ent:GetOwner():MedicNotif( sentences["Someone is giving you CPR"][lang], 10)
end
if SERVER then
StopMedicAnimation( ply )
StartMedicAnimation( ply, 2 )
end
end)
if SERVER then
if not ent:GetOwner():GetHeartAttack() then ent:GetOwner().AddToSpawnTime = 0 return end
if not ent:GetOwner():IsPoisoned() and not ent:GetOwner():IsBleeding() then
ent:GetOwner().AddToSpawnTime = ent:GetOwner().NextSpawnTime - CurTime()
ent:GetOwner().NextSpawnTime = -1
net.Start("MedicMod.Respawn")
net.WriteInt(-1,32)
net.Send(ent:GetOwner())
else
ent:GetOwner().AddToSpawnTime = 0
end
end
end)