Advertisement
CapsAdmin

Untitled

Nov 22nd, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.65 KB | None | 0 0
  1. if SERVER then
  2.    
  3.     hook.Add("Think", "dmgmode5", function()
  4.         for key, ply in pairs(player.GetAll()) do
  5.             local mode = ply:GetInfoNum("cl_dmg_mode")
  6.            
  7.             ply.dmgmode5 = ply.dmgmode5 or {}
  8.             local data = ply.dmgmode5
  9.            
  10.             if mode == 5 then
  11.                 if not ply:Alive() then
  12.                     ply:Spawn()
  13.                     ply:SetPos(data.pos)
  14.                     ply:SetVelocity(data.vel)
  15.                    
  16.                     if data.wep then
  17.                         ply:Give(data.wep)
  18.                         ply:SelectWeapon(data.wep)
  19.                     end
  20.                 else
  21.                     data.pos = ply:GetPos()
  22.                     data.vel = ply:GetVelocity()
  23.                    
  24.                     local wep = ply:GetActiveWeapon()
  25.                     if wep:IsValid() then
  26.                         data.wep = wep:GetClass()
  27.                     end
  28.                 end
  29.             end
  30.         end
  31.     end)
  32.  
  33.     hook.Add("EntityTakeDamage", "dmgmode6", function(a, dmginfo)
  34.         local b = dmginfo:GetAttacker()
  35.        
  36.         if a:IsPlayer() then
  37.             local mode = a:GetInfoNum("cl_dmg_mode")
  38.             if mode == 6 and a:Health() - dmginfo:GetDamage() < 1 then
  39.                 dmginfo:SetDamage(0)
  40.                 a:CreateRagdoll()
  41.                 umsg.Start("death")
  42.                 umsg.Entity(a)
  43.                 umsg.End()
  44.                 a:SetNotSolid(true)
  45.                
  46.                 timer.Create(tostring(a), 3, 1, function()
  47.                     a:SetNotSolid(false)
  48.                     a:SetHealth(a:GetMaxHealth())
  49.                 end)
  50.             end
  51.         end
  52.     end)
  53.    
  54. end
  55.  
  56. if CLIENT then
  57.  
  58.     usermessage.Hook("death", function(umr)
  59.         local ent = umr:ReadEntity()
  60.         if ent:IsValid() then
  61.             ent.RenderOverride = function(p) end
  62.             local wep = ent:GetActiveWeapon()
  63.             wep.RenderOverride = function(p) end
  64.             ent:SetModelScale(Vector(0,0,0))
  65.                
  66.             timer.Create(tostring(ent), 3,1, function()
  67.                 ent.RenderOverride = nil
  68.                 wep.RenderOverride = nil
  69.                 ent:SetModelScale(Vector(1,1,1))
  70.             end)
  71.         end
  72.     end)
  73.    
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement