• GetBonePosition causes errors.
    6 replies, posted
[code][ERROR] addons/kingpin_loc_playermodels_170055513/lua/weapons/kingpin_flamegun/shared.lua:139: bad argument #1 to 'GetBonePosition' (number expected, got nil) 1. GetBonePosition - [C]:-1 2. Light - addons/kingpin_loc_playermodels_170055513/lua/weapons/kingpin_flamegun/shared.lua:139 3. unknown - addons/kingpin_loc_playermodels_170055513/lua/weapons/kingpin_flamegun/shared.lua:108 [/code] [code]function SWEP:Light() local Bone = self.Owner:GetViewModel():LookupBone( "Penis" ) local Attachment = self.Owner:GetViewModel():GetBonePosition(Bone) local effectdata = EffectData() effectdata:SetStart( Attachment ) effectdata:SetOrigin( Attachment ) util.Effect("kp_flight", effectdata) end[/code] And while you are here, I have another function that does absolutely nothing: [code]function SWEP:Think() self:Stuff() if self.Owner:GetAmmoCount("ammo_flameammo") > 200 then self.Owner:SetAmmo(200, "ammo_flameammo") if ( self.Owner:KeyPressed( IN_ATTACK ) ) then self:StartAttack() end elseif ( self.Owner:KeyReleased( IN_ATTACK ) ) then self:EndAttack() end end[/code] [code]function SWEP:StartAttack() self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK) end function SWEP:EndAttack() if !self.bInAttack || self.Owner:KeyDown(IN_ATTACK) then return end self.Weapon:SendWeaponAnim(ACT_VM_SECONDARYATTACK) if SERVER then self.Owner:EmitSound(Sound("v_flamegun/flameend.wav")) end self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) end[/code]
It means, that this code: [code]local Bone = self.Owner:GetViewModel():LookupBone( "Penis" )[/code] return nil because the view model doesn't have that attachment.
[QUOTE=Robotboy655;43629614]It means, that this code: [code]local Bone = self.Owner:GetViewModel():LookupBone( "Penis" )[/code] return nil because the view model doesn't have that attachment.[/QUOTE] I didn't make it as attachment ( It's not an attachment in QC ), it's just a bone.
Sorry, yes, this means that there's no such bone. Are you use it exist and are you sure you are running clientside only?
[img]http://puu.sh/6u1vk.png[/img] And I compiled it with this bone.
[QUOTE=Robotboy655;43629749]Sorry, yes, this means that there's no such bone. Are you use it exist and [B]are you sure you are running clientside only?[/B][/QUOTE]
Fixed, now need to solve the second problem.
Sorry, you need to Log In to post a reply to this thread.