Hi guys,
I have a error with my addons because when i pick the weapon i have error in console :
Giving MyPseudo a weapon
[MyPseudo|2|STEAM_0:0:000000000] Lua Error:
[ERROR] addons/---/lua/weapons/---/shared.lua:118: bad argument #1 to 'GetBoneMatrix' (number expected, got no value)
1. GetBoneMatrix - [C]:-1
2. unknown - addons/---/lua/weapons/---/shared.lua:118
I hide a lot of informations because i prepare this addons and it's surprise but i have this error my friend say : you don't have css content because i mount css content
I need help please !!
Did you read the error? GetBoneMatrix needs a number but you're not giving it anything. Check if what you try to call GetBoneMatrix with is a number before calling it.
Do you want the code because i am so bad
if CLIENT then
function SWEP:ViewModelDrawn(vm)
local vm = self.Owner:GetViewModel()
local matrix = vm:GetBoneMatrix(vm:LookupBone("v_weapon.c4"))
local pos = matrix:GetTranslation()
local ang = matrix:GetAngles()
local ang1 = matrix:GetAngles()
ang:RotateAroundAxis(ang:Up(), -90)
ang:RotateAroundAxis(ang:Right(), -90)
cam.Start3D2D(pos +ang:Up() *-2.7, ang, 0.1)
draw.RoundedBox(0, -13, 18, 15, 29, Color(0, 0, 0))
cam.End3D2D()
if self:GetNWString("---") ~= "" then
cam.Start3D2D(pos +ang:Up() *-2.7, ang, 0.1)
draw.RoundedBox(0, -12, 18, 14, 29, Color(65, 65, 65))
draw.RoundedBox(0, -13, 18, 2, 29, Color(0, 0, 255))
cam.End3D2D()
ang1:RotateAroundAxis(ang1:Right(), 180)
ang1:RotateAroundAxis(ang1:Forward(), -90)
cam.Start3D2D(pos +ang1:Up() *2.7, ang1, 0.018)
draw.SimpleText("---", "DermaDefault", 138, -75, Color(255, 255, 0))
cam.End3D2D()
cam.Start3D2D(pos +ang1:Up() *2.7, ang1, 0.026)
if string.find(self:GetNWString("---"), "*") then
draw.SimpleText(string.Replace(self:GetNWString("---"), "*", tostring(math.random(1, 9))), "DermaLarge", 73, -34, Color(255, 255, 0))
else
draw.SimpleText(self:GetNWString("---"), "DermaLarge", 73, -34, Color(255, 255, 0, 255 -math.sin(CurTime() *8) *255))
end
cam.End3D2D()
end
end
else
Entity:LookupBone isn't returning anything which means the bone doesn't exist on the viewmodel. You should define a variable for the bone and check if it exists. There's also no need to define your own vm variable since the viewmodel entity gets passed to the hook as the first argument.
Sorry,sorry,sorry
I don't understand, do you help me doing the code please
Please
Sorry, you need to Log In to post a reply to this thread.