Advertisement
CapsAdmin

Untitled

Apr 18th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 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.Create("prop_dynamic")
  10.             ent:SetModel("models/weapons/c_arms_cstrike.mdl")
  11.             ent:SetParent(vm)
  12.             ent:AddEffects(EF_BONEMERGE)
  13.             ent:SetNoDraw(true)
  14.             ply.arm_mdl = ent
  15.         else
  16.             ply.arm_mdl:DrawModel()
  17.         end
  18.     end)
  19. end
  20.  
  21. if SERVER then 
  22.     hook.Add("Think", "viewmodel_test", function()
  23.         for key, ply in pairs(player.GetAll()) do
  24.             local vm = ply:GetViewModel()
  25.                
  26.             if vm:IsValid() then
  27.                 local mdl = vm:GetModel()
  28.                 mdl = mdl:gsub("v_", "c_")
  29.                
  30.                 if vm:GetModel() ~= mdl then
  31.                     vm:SetModel(mdl)
  32.                 end
  33.             end
  34.         end
  35.     end)
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement