Advertisement
Guest User

Untitled

a guest
May 3rd, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.29 KB | None | 0 0
  1. local clientModels = {}
  2. clientModels["jb_knife"] = ClientsideModel("models/weapons/w_knife_t.mdl");
  3. clientModels["jb_grenade_smoke"] = ClientsideModel("models/weapons/w_eq_smokegrenade.mdl");
  4.  
  5. hook.Add("PostPlayerDraw","JBDrawWeaponsOnPlayer",function(p)
  6.     local weps = p:GetWeapons();
  7.  
  8.     for k, v in pairs(weps)do
  9.         local mdl = clientModels[v:GetClass()];
  10.         if mdl and p:GetActiveWeapon() and p:GetActiveWeapon():IsValid() and p:GetActiveWeapon():GetClass() ~= v:GetClass() then
  11.             if string.Left(v:GetClass(),12) == "jb_secondary" then
  12.                 local boneindex = p:LookupBone("ValveBiped.Bip01_R_Thigh")
  13.                 if boneindex then
  14.                     local pos, ang = p:GetBonePosition(boneindex)
  15.  
  16.                     ang:RotateAroundAxis(ang:Forward(),90)
  17.                     mdl:SetRenderOrigin(pos+(ang:Right()*4.5)+(ang:Up()*-1.5));
  18.                     mdl:SetRenderAngles(ang);
  19.                     mdl:DrawModel();
  20.                 end
  21.             elseif string.Left(v:GetClass(),10) == "jb_primary" then
  22.                 local boneindex = p:LookupBone("ValveBiped.Bip01_Spine2")
  23.                 if boneindex then
  24.                     local pos, ang = p:GetBonePosition(boneindex)
  25.  
  26.                     ang:RotateAroundAxis(ang:Forward(),0)
  27.                     mdl:SetRenderOrigin(pos+(ang:Right()*4)+(ang:Forward()*-5));
  28.                     ang:RotateAroundAxis(ang:Right(),-15)
  29.                     mdl:SetRenderAngles(ang);
  30.                     mdl:DrawModel();
  31.                 end
  32.             elseif v:GetClass() == "jb_knife" then
  33.                 local boneindex = p:LookupBone("ValveBiped.Bip01_L_Thigh")
  34.                 if boneindex then
  35.                     local pos, ang = p:GetBonePosition(boneindex)
  36.  
  37.                     ang:RotateAroundAxis(ang:Forward(),90)
  38.                     ang:RotateAroundAxis(ang:Right(),-56)
  39.                     mdl:SetRenderOrigin(pos+(ang:Right()*-4.2)+(ang:Up()*2));
  40.                     mdl:SetRenderAngles(ang);
  41.                     mdl:DrawModel();
  42.                 end
  43.             elseif string.Left(v:GetClass(),10) == "jb_grenade" then
  44.                 local boneindex = p:LookupBone("ValveBiped.Bip01_L_Thigh")
  45.                 if boneindex then
  46.                     local pos, ang = p:GetBonePosition(boneindex)
  47.  
  48.                     ang:RotateAroundAxis(ang:Forward(),10)
  49.                     ang:RotateAroundAxis(ang:Right(),90)
  50.                     mdl:SetRenderOrigin(pos+(ang:Right()*-6.5)+(ang:Up()*-1));
  51.                     mdl:SetRenderAngles(ang);
  52.                     mdl:DrawModel();
  53.                 end
  54.             end
  55.         end
  56.     end
  57. end)
  58.  
  59. function JB:CheckWeaponTable(class,model)
  60.     if clientModels[class] then return end
  61.  
  62.     clientModels[class] = ClientsideModel(model,RENDERGROUP_OPAQUE);
  63. end
  64.  
  65. function printmodels()
  66.     PrintTable(clientModels)
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement