Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ENT:OnTakeDamage(dmg)
- local pl = self:GetOwner()
- local attacker = dmg:GetAttacker()
- local inflictor = dmg:GetInflictor()
- -- Health
- if pl && pl:IsValid() && pl:Alive() && pl:IsPlayer() && attacker:IsPlayer() && dmg:GetDamage() > 0 then
- self.health = self.health - dmg:GetDamage()
- pl:SetHealth(self.health)
- if self.health <= 0 then
- pl:Kill() ----- Changed from KillSilent() to Kill() for the XP system to work properly
- if inflictor && inflictor == attacker && inflictor:IsPlayer() then
- inflictor = inflictor:GetActiveWeapon()
- if !inflictor || inflictor == NULL then inflictor = attacker end
- end
- net.Start( "PlayerKilledByPlayer" )
- net.WriteEntity( pl )
- net.WriteString( inflictor:GetClass() )
- net.WriteEntity( attacker )
- net.Broadcast()
- SimpleXPTrackKills(pl,inflictor,attacker) -- Added for XP system to work properly
- MsgAll( attacker:Nick() .. " killed " .. pl:Nick() .. " using " .. inflictor:GetClass() .. "\n" )
- attacker:AddFrags(1)
- pl:AddDeaths(1)
- attacker:SetHealth(math.Clamp(attacker:Health() + GetConVar("HUNTER_KILL_BONUS"):GetInt(), 1, 100))
- pl:RemoveProp()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement