Problem with SWEP

Maybe my thread must be in modeling forum, but i think this is lua problem. World model dosn’t attach correctly and i can’t set HoldType for my SWEP.
http://img163.imageshack.us/img163/1729/gmpshugeflatconstructsvk.th.jpg

Show us code, HoldType has to be shared

In shared.lua:



function SWEP:Initialize()
if(SERVER) then
self:SetWeaponHoldType(self.HoldType)
end
end

In init.lua:

SWEP.HoldType			= "melee"

[lua]SWEP.HoldType = “melee”
function SWEP:Initialize()
self:SetWeaponHoldType(self.HoldType)
end[/lua]

in shared.lua

Does no effect :frowning:

It must be a problem with the model then, the hand bone looks like it is in the wrong place.

For the model attaching its not bone-merging propperly. that is a modelling problem

And what modeller must do? Add $attachment into .qc? If yes, how? Sorry for so much questions :slight_smile:

He mustparent the weapon to a bone named a specific thing

ValveBiped.Bip01_R_Hand, right?

Yea

[editline]03:49PM[/editline]

The bone will be merged with the hand bone, so put the bone on the handle

Thx you a lot.^^ It works. But HoldType doesn’t >_<
http://img683.imageshack.us/img683/1654/gmconstruct0013n.th.jpg

Show all code

shared.lua

include("cl_init.lua")
SWEP.Base				= "weapon_base"
SWEP.HoldType			= "melee"

function SWEP:Initialize()
util.PrecacheSound("banhammer/fail.wav")
util.PrecacheSound("banhammer/hit.wav")
if(SERVER) then
self:SetWeaponHoldType(self.HoldType)
end
end
//Weapon Code

init.lua

 AddCSLuaFile( "cl_init.lua" )
 AddCSLuaFile( "shared.lua" )
 include('shared.lua')

cl_init.lua

include("shared.lua")
//Author and other details

Shared should look like this:

[lua] – include(“cl_init.lua”) don’t include cl_init in shared
SWEP.Base = “weapon_base”
SWEP.HoldType = “melee”

function SWEP:Initialize()
util.PrecacheSound(“banhammer/fail.wav”)
util.PrecacheSound(“banhammer/hit.wav”)
– if(SERVER) then This is what is wrong!!!
self:SetWeaponHoldType(self.HoldType)
–end
end[/lua]

:ninja:

Obviously you can remove the comments.

[editline]06:46PM[/editline]

automerge

Ohh… It works, thanks. Maybe I’ll annoy you with other errors ^^

Please dont :saddowns:

Yea :smug: