• Arms aren't rendering with a "Leg Script"
    0 replies, posted
Hey guys, I'm trying to get this legs script working (The one where you can see your legs, in a car and when you look down etc.) But for some unknown reason, apparently Kleiner has no arms or the script just doesn't want to render the arms. [IMG]http://puu.sh/30yvJ.jpg[/IMG] [LUA]if SERVER then AddCSLuaFile() return end local cl_legs = CreateConVar( "cl_legs", "1", { FCVAR_ARCHIVE, }, "Enable/Disable the rendering of the legs" ) local cl_legs_vehicle = CreateConVar( "cl_legs_vehicle", "0", { FCVAR_ARCHIVE, }, "Enable/Disable the rendering of the legs in a vehicle" ) local Legs = { FixedModelNames = { -- Broken model path = key, fixed model path = value ["models/humans/group01/female_06.mdl"] = "models/player/group01/female_06.mdl", ["models/humans/group01/female_01.mdl"] = "models/player/group01/female_01.mdl", ["models/alyx.mdl"] = "models/player/alyx.mdl", ["models/humans/group01/female_07.mdl"] = "models/player/group01/female_07.mdl", ["models/charple01.mdl"] = "models/player/charple01.mdl", ["models/humans/group01/female_04.mdl"] = "models/player/group01/female_04.mdl", ["models/humans/group03/female_06.mdl"] = "models/player/group03/female_06.mdl", ["models/gasmask.mdl"] = "models/player/gasmask.mdl", ["models/humans/group01/female_02.mdl"] = "models/player/group01/female_02.mdl", ["models/gman_high.mdl"] = "models/player/gman_high.mdl", ["models/humans/group03/male_07.mdl"] = "models/player/group03/male_07.mdl", ["models/humans/group03/female_03.mdl"] = "models/player/group03/female_03.mdl", ["models/police.mdl"] = "models/player/police.mdl", ["models/breen.mdl"] = "models/player/breen.mdl", ["models/humans/group01/male_01.mdl"] = "models/player/group01/male_01.mdl", ["models/zombie_soldier.mdl"] = "models/player/zombie_soldier.mdl", ["models/humans/group01/male_03.mdl"] = "models/player/group01/male_03.mdl", ["models/humans/group03/female_04.mdl"] = "models/player/group03/female_04.mdl", ["models/humans/group01/male_02.mdl"] = "models/player/group01/male_02.mdl", ["models/kleiner.mdl"] = "models/player/kleiner.mdl", ["models/humans/group03/female_01.mdl"] = "models/player/group03/female_01.mdl", ["models/humans/group01/male_09.mdl"] = "models/player/group01/male_09.mdl", ["models/humans/group03/male_04.mdl"] = "models/player/group03/male_04.mdl", ["models/player/urban.mbl"] = "models/player/urban.mdl", -- It fucking returns the file type wrong as "mbl" D: ["models/humans/group03/male_01.mdl"] = "models/player/group03/male_01.mdl", ["models/mossman.mdl"] = "models/player/mossman.mdl", ["models/humans/group01/male_06.mdl"] = "models/player/group01/male_06.mdl", ["models/humans/group03/female_02.mdl"] = "models/player/group03/female_02.mdl", ["models/humans/group01/male_07.mdl"] = "models/player/group01/male_07.mdl", ["models/humans/group01/female_03.mdl"] = "models/player/group01/female_03.mdl", ["models/humans/group01/male_08.mdl"] = "models/player/group01/male_08.mdl", ["models/humans/group01/male_04.mdl"] = "models/player/group01/male_04.mdl", ["models/humans/group03/female_07.mdl"] = "models/player/group03/female_07.mdl", ["models/humans/group03/male_02.mdl"] = "models/player/group03/male_02.mdl", ["models/humans/group03/male_06.mdl"] = "models/player/group03/male_06.mdl", ["models/barney.mdl"] = "models/player/barney.mdl", ["models/humans/group03/male_03.mdl"] = "models/player/group03/male_03.mdl", ["models/humans/group03/male_05.mdl"] = "models/player/group03/male_05.mdl", ["models/odessa.mdl"] = "models/player/odessa.mdl", ["models/humans/group03/male_09.mdl"] = "models/player/group03/male_09.mdl", ["models/humans/group01/male_05.mdl"] = "models/player/group01/male_05.mdl", ["models/humans/group03/male_08.mdl"] = "models/player/group03/male_08.mdl", --Thanks Jvs ["models/monk.mdl"] = "models/player/monk.mdl", ["models/eli.mdl"] = "models/player/eli.mdl", }, BoneHoldTypes = { -- Can change to whatever you want, I think these two look best ["none"] = { "ValveBiped.Bip01_Head1", "ValveBiped.Bip01_Neck1", "ValveBiped.Bip01_Spine4", "ValveBiped.Bip01_Spine2", }, ["default"] = { -- The default bones to be hidden if there is no hold type bones "ValveBiped.Bip01_Head1", "ValveBiped.Bip01_Neck1", "ValveBiped.Bip01_Spine4", "ValveBiped.Bip01_Spine2", "ValveBiped.Bip01_L_Hand", "ValveBiped.Bip01_L_Forearm", "ValveBiped.Bip01_L_Upperarm", "ValveBiped.Bip01_L_Clavicle", "ValveBiped.Bip01_R_Hand", "ValveBiped.Bip01_R_Forearm", "ValveBiped.Bip01_R_Upperarm", "ValveBiped.Bip01_R_Clavicle", "ValveBiped.Bip01_L_Finger4", "ValveBiped.Bip01_L_Finger41", "ValveBiped.Bip01_L_Finger42", "ValveBiped.Bip01_L_Finger3", "ValveBiped.Bip01_L_Finger31", "ValveBiped.Bip01_L_Finger32", "ValveBiped.Bip01_L_Finger2", "ValveBiped.Bip01_L_Finger21", "ValveBiped.Bip01_L_Finger22", "ValveBiped.Bip01_L_Finger1", "ValveBiped.Bip01_L_Finger11", "ValveBiped.Bip01_L_Finger12", "ValveBiped.Bip01_L_Finger0", "ValveBiped.Bip01_L_Finger01", "ValveBiped.Bip01_L_Finger02", "ValveBiped.Bip01_R_Finger4", "ValveBiped.Bip01_R_Finger41", "ValveBiped.Bip01_R_Finger42", "ValveBiped.Bip01_R_Finger3", "ValveBiped.Bip01_R_Finger31", "ValveBiped.Bip01_R_Finger32", "ValveBiped.Bip01_R_Finger2", "ValveBiped.Bip01_R_Finger21", "ValveBiped.Bip01_R_Finger22", "ValveBiped.Bip01_R_Finger1", "ValveBiped.Bip01_R_Finger11", "ValveBiped.Bip01_R_Finger12", "ValveBiped.Bip01_R_Finger0", "ValveBiped.Bip01_R_Finger01", "ValveBiped.Bip01_R_Finger02" }, ["vehicle"] = { -- Bones that are deflated while in a vehicle "ValveBiped.Bip01_Head1", "ValveBiped.Bip01_Neck1", "ValveBiped.Bip01_Spine4", "ValveBiped.Bip01_Spine2", } }, } local _R = debug.getregistry() function _R.Player:GetFixedModel() -- For some reason, the client returns the original HL2 version model of the player, not the player model.. Weird right? Only applies to the default player models. local mdl = self:GetModel() return Legs.FixedModelNames[ mdl ] or mdl end _R.Legs = {} _R.Legs.__index = _R.Legs local function CreateLegs() -- Creates our legs local ent = ClientsideModel( LocalPlayer():GetFixedModel(), RENDER_GROUP_OPAQUE_ENTITY ) ent:SetNoDraw( true ) -- We render the model differently ent:SetSkin( LocalPlayer():GetSkin() ) ent:SetMaterial( LocalPlayer():GetMaterial() ) ent.GetPlayerColor = function() return LocalPlayer():GetPlayerColor() end -- Tanks to samm5506 from the Elevator: Source team return setmetatable( { Entity = ent, NextBreath = CurTime(), LastTick = CurTime(), LastWeapon = nil, LastSeq = nil, }, _R.Legs ) end function _R.Legs:IsValid() return IsValid( self.Entity ) end function _R.Legs:ShouldDraw() return cl_legs:GetBool() and self:IsValid() and LocalPlayer():Alive() and ( LocalPlayer():InVehicle() and cl_legs_vehicle:GetBool() or !LocalPlayer():InVehicle() ) and GetViewEntity() == LocalPlayer() and !LocalPlayer():ShouldDrawLocalPlayer() and !LocalPlayer():GetObserverTarget() and !LocalPlayer().ShouldDisableLegs end function _R.Legs:UpdateAnimation( groundSpeed ) if !self:IsValid() then return end if LocalPlayer():GetActiveWeapon() != self.LastWeapon then -- Player switched weapons, change the bones for new weapon self.LastWeapon = LocalPlayer():GetActiveWeapon() self:OnSwitchedWeapon( self.LastWeapon ) end if self.Entity:GetModel() != LocalPlayer():GetFixedModel() then -- Player changed model without spawning? self.Entity:SetModel( LocalPlayer():GetFixedModel() ) end self.Entity:SetMaterial( LocalPlayer():GetMaterial() ) self.Entity:SetSkin( LocalPlayer():GetSkin() ) local vel = LocalPlayer():GetVelocity():Length2D() local playRate = 1 if vel > 0.5 then -- Taken from the SDK, gets the proper play back rate if groundSpeed < 0.001 then playRate = 0.01 else playRate = vel / groundSpeed pla
Sorry, you need to Log In to post a reply to this thread.