CapsAdmin

Untitled

Apr 18th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. if CLIENT then
  2.     for k,v in pairs(player.GetAll()) do SafeRemoveEntity(v.arm_mdl) end
  3.    
  4.     hook.Add("PostDrawViewModel", "viewmodel_Test", function()
  5.         local ply = LocalPlayer()
  6.         local vm = ply:GetViewModel()
  7.        
  8.         if not IsValid(ply.arm_mdl) then
  9.             local ent = ents.CreateClientProp()
  10.             ent:SetModel(ply:GetModel())
  11.             ent:SetParent(vm)
  12.             ent:AddEffects(EF_BONEMERGE)
  13.             ent:SetOwner(ply)
  14.             ent:SetNoDraw(true)
  15.             ent.GetPlayerColor = function()
  16.                 return ply:GetPlayerColor()    
  17.             end
  18.             ply.arm_mdl = ent
  19.         else
  20.             local ent = ply.arm_mdl
  21.             ent:DrawModel()
  22.        
  23.             for i = 1, ent:GetBoneCount() do
  24.                 local name = ent:GetBoneName(i)
  25.                    
  26.                 if name then
  27.                     name = name:lower()
  28.                     if name:find("head") then
  29.                         ent:ManipulateBoneScale(i, Vector(0,0,0))
  30.                     end
  31.                 end
  32.             end
  33.         end
  34.     end)
  35. end
  36.  
  37. if SERVER then 
  38.     hook.Add("Think", "viewmodel_test", function()
  39.         for key, ply in pairs(player.GetAll()) do
  40.             local vm = ply:GetViewModel()
  41.                
  42.             if vm:IsValid() then
  43.                 local mdl = vm:GetModel()
  44.                 mdl = mdl:gsub("v_", "c_")
  45.                
  46.                 if vm:GetModel() ~= mdl then
  47.                     vm:SetModel(mdl)
  48.                 end
  49.             end
  50.         end
  51.     end)
  52. end
Advertisement
Add Comment
Please, Sign In to add comment