1. Post #321

    May 2011
    1 Posts
    Hey Clavus, i know how you are saying this is not a Model maker for people. I just want to tell you that;
    1. Making a video explaining how to use this. I know you probably will say no, but i havent found a good explaining tutorial about how to script stuff. I promise you that this will make you gain alot of downloads and likes/favourites/reps (whatever you want for each site you have this on.)
    2. I love this man, it is really great. You wanted me to check out the tutorial on gmodwiki and i did. Eventhough i didnt understand anything :)

  2. Post #322
    amkoc's Avatar
    January 2011
    562 Posts
    The model browser doesn't seem to be able to find all models; could we have a button to update the view/world models with custom-entered model paths?

    Edited:

    Also, I don't seem to be able to get the worldmodel working

  3. Post #323
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    Hey Clavus, i know how you are saying this is not a Model maker for people. I just want to tell you that;
    1. Making a video explaining how to use this. I know you probably will say no, but i havent found a good explaining tutorial about how to script stuff. I promise you that this will make you gain alot of downloads and likes/favourites/reps (whatever you want for each site you have this on.)
    2. I love this man, it is really great. You wanted me to check out the tutorial on gmodwiki and i did. Eventhough i didnt understand anything :)
    Scripting knowledge is required to put these designs to use, no video tutorial is going to fix that.

    Another thing you can do is just wait for someone else to build another level of functionality on top of it, like this guy did: http://www.facepunch.com/threads/106...zable-Weaponry

    The model browser doesn't seem to be able to find all models; could we have a button to update the view/world models with custom-entered model paths?

    Edited:

    Also, I don't seem to be able to get the worldmodel working
    You can just copy past paths from GMod's model browser in the text fields that define models in the SCK tool, in case my model browser isn't working out for you (although it should work just fine).

  4. Post #324
    Hey Clavus, could you please add a menu for the WModels to select which to which hand to parent a CModel? It would be very, very useful

    Thanks in advance.

  5. Post #325
    Rikimaru Tsuki's Avatar
    January 2011
    22 Posts
    [addons\c-14 impaler gauss rifle\lua\weapons\weapon\shared.lua:126] '<eof>' expected near 'end'
    Cant make it to work for some reason. it wont show up in the weapons menu. :/ help anyone?
    http://pastebin.com/NgSVpGyk

    Edit: Nevermind. i figured it out :P

  6. Post #326
    amkoc's Avatar
    January 2011
    562 Posts
    Scripting knowledge is required to put these designs to use, no video tutorial is going to fix that.

    Another thing you can do is just wait for someone else to build another level of functionality on top of it, like this guy did: http://www.facepunch.com/threads/106...zable-Weaponry



    You can just copy past paths from GMod's model browser in the text fields that define models in the SCK tool, in case my model browser isn't working out for you (although it should work just fine).
    Yeah I figured it out - the file.exists' were failing so it wasn't loading copy/pasted paths - I've eliminated most of them and it works great now, nice job

  7. Post #327
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    Hey Clavus, could you please add a menu for the WModels to select which to which hand to parent a CModel? It would be very, very useful

    Thanks in advance.
    I'll look at it.

  8. Post #328
    I'll look at it.
    Thanks!

  9. Post #329
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    And there we go:
    http://dl.dropbox.com/u/11217331/Rel...uction_kit.zip

    Changelog 1.4
    - Added option to change parent bone for world models. You can use this to make weapon specific outfits and stuff (like a back mounted canister for a flamethrower)
    - Added button to open this thread directly from the SCK menu
    Edited:

    Remember to grab the updated base code from OP.

    Edited:

    While I'm at it, check out my (totally unrelated to this thread) Particle System Tester tool that I just updated. Useful for previewing particle effects.
    Reply With Quote Edit / Delete Reply Netherlands Show Events Lua King Lua King x 1Winner Winner x 1 (list)

  10. Post #330
    And there we go:
    http://dl.dropbox.com/u/11217331/Rel...uction_kit.zip

    Changelog 1.4


    Edited:

    Remember to grab the updated base code from OP.

    Edited:

    While I'm at it, check out my (totally unrelated to this thread) Particle System Tester tool that I just updated. Useful for previewing particle effects.
    Thanks for updating it! That particle system tester tool is damn useful too!

    Great work!

  11. Post #331
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    Fixed the main post by putting a large part in quotes so the img_thumb things work again. I have no idea why Garry would remove them from normal posts. It's stupid.

  12. Post #332
    amkoc's Avatar
    January 2011
    562 Posts
    Oh, btw, the viewmodel bones list sometimes has more bones than can actually be displayed on screen at once, could that have scrolling added?

  13. Post #333
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    Oh, btw, the viewmodel bones list sometimes has more bones than can actually be displayed on screen at once, could that have scrolling added?
    It's an issue with the Derma control that I tried to report to Garry a multiple times, but it keeps getting ignored. I think the best thing we could do is change the DMultiChoice control code ourselves and then suggest to Garry to throw it in GMod. Requires minimal effort on his part, but I haven't got around to doing this myself.

  14. Post #334
    Clavus, may I make a request if that's okay? Can you add in an option to parent stuff to CModels that are already created and positioned/etc. ? That way it's easier to add stuff to them instead of parenting to a viewmodel bone and positioning over and over again if the starting position is off.

  15. Post #335
    Gold Member
    s0beit's Avatar
    August 2010
    2,574 Posts
    Good job again, any chance the playing animations will come back?

  16. Post #336
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    Clavus, may I make a request if that's okay? Can you add in an option to parent stuff to CModels that are already created and positioned/etc. ? That way it's easier to add stuff to them instead of parenting to a viewmodel bone and positioning over and over again if the starting position is off.
    I thought about that but it makes things a lot more complicated. I'll look at it but no promises.

    Good job again, any chance the playing animations will come back?
    Sometimes the animations seem to function, other times they don't. Last time I somehow fixed them by going in & out of 3rd person mode. Still half the animation constants don't do anything.

    I'll re-enable em soon.

  17. Post #337
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    Productivity ho!

    http://dl.dropbox.com/u/11217331/Rel...uction_kit.zip

    Changelog:

    v1.5:
    - Added the 'Relative' field for every element. Allows you to parent an element to another element instead of a bone. Simplifies editing of complex designs and allows for animating movement around different positions instead of only bone positions
    - Brought back the animation buttons. Still buggy (switching to 3rd person mode and back seems to fix the 1st person animations after opening the menu for the first time)
    - Added several tooltips
    Grab the latest base code from the OP. It keeps getting bigger!
    Reply With Quote Edit / Delete Reply Windows 7 Netherlands Show Events Winner Winner x 1 (list)

  18. Post #338
    Gold Member
    s0beit's Avatar
    August 2010
    2,574 Posts
    You know what's be fun to add, is if you added first person sequences as well.

    For example, make a textbox with "Set Sequence" or whatever you would like to call it, have it
    function SWEP:SpecialAnimation(anim)
    	self:SendWeaponAnim(ACT_VM_HOLSTER)
    	self.Owner:GetViewModel():SetSequence(self.Owner:GetViewModel():LookupSequence(anim))
    	self.Owner:GetViewModel():SetCycle(0)
    	self:SetCycle(0)
    end
    

    Function takes a string, from Zoey's Firearms: Source SWEP pack, so for example
    self:SpecialAnimation("reload_empty1")
    

    and all that mess, just a thought, thanks for putting animation stuff back

  19. Post #339
    Hell yeah! Thanks man!

  20. Post #340
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    I didn't actually test what happens if you set two elements to be each other's relative but I suspect they'll just flip the fuck out without any dire consequences for the stability of the tool or GMod itself.
    Reply With Quote Edit / Delete Reply Windows 7 Netherlands Show Events Funny Funny x 4 (list)

  21. Post #341
    Random guy
    LegoGuy's Avatar
    March 2009
    1,914 Posts
    What if, you could type in what animation you want the Model to do in The COntrustions kit?
    For example, one of the models I'm using has.
    ACT_VM_PRIMARYATTACK_2
    others have
    ACT_VM_FIDGET

    So if there could be a small field were you could type in what you would want...
    Just a thought.

  22. Post #342
    LOLDUDE's Avatar
    April 2010
    224 Posts
    This add-on is so amazingly useful.
    Unfortunately, I don't know how to add the base script you said to a weapon's script with it still working. Can you provide a base script with all of the basic info (e.g. SWEP.Printname = "namehere", etc)

  23. Post #343
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    Last GMod update seems to have fucked over third person view. :/

    EDIT: nvm seems to be a conflicting addon... learned another thing about hooks.

  24. Post #344
    werewolf0020's Avatar
    October 2009
    5,604 Posts
    This add-on is so amazingly useful.
    Unfortunately, I don't know how to add the base script you said to a weapon's script with it still working. Can you provide a base script with all of the basic info (e.g. SWEP.Printname = "namehere", etc)
    Dude just create an empty text file and copy and paste the base code there thats all

    it isnt soo hard

  25. Post #345
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    Dude just create an empty text file and copy and paste the base code there thats all

    it isnt soo hard
    Not entirely true since the base code isn't a complete SWEP on its own. It is however, piss easy to combine with things like the default CSS SWEPs code.

  26. Post #346
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    I've updated the SCK with two small fixes.

    * You can no longer end up with a stack overflow due to a loop in the element parent system
    * The 3rd person mode no longer has compatibility problems with other addons

    Usual download
    Reply With Quote Edit / Delete Reply Windows 7 Netherlands Show Events Winner Winner x 1 (list)

  27. Post #347
    Gold Member
    Jamie932's Avatar
    July 2008
    2,589 Posts
    Nice work - still using this and it's been seven months. Is it possible for you to add the ability to rotate bones?
    Reply With Quote Edit / Delete Reply Windows 7 United Kingdom Show Events Agree Agree x 1 (list)

  28. Post #348
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    Nice work - still using this and it's been seven months. Is it possible for you to add the ability to rotate bones?
    Like rotate the existing bones of a viewmodel or worldmodel? I don't really know, it'd make things pretty complex. I'll have to look at that Lua animations API or something.
    Reply With Quote Edit / Delete Reply Windows 7 Netherlands Show Events Winner Winner x 1 (list)

  29. Post #349
    FLUTTERSHY <3 (also hats suck)
    Unib5's Avatar
    May 2008
    1,700 Posts
    [@!toybox_11926:3612] bad argument #1 to 'pairs' (table expected, got nil)

    Just thought I'd make you aware of this - it's happening on both download and the toybox version.

  30. Post #350
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    Where the fuck did the CalcView hook go.

    Edited:

    I updated the code so it doesn't spam errors any more, but 3rd person view won't work until I sort this out.

    Edited:

    Oh I think I found what's wrong. Updating...

    Edited:

    Fixed now.

  31. Post #351
    Where the fuck did the CalcView hook go.

    Edited:

    I updated the code so it doesn't spam errors any more, but 3rd person view won't work until I sort this out.

    Edited:

    Oh I think I found what's wrong. Updating...

    Edited:

    Fixed now.
    I can help you out with the bone rotation/placement, Jvs has taught me how to.

    Add me on Steam, if you're interested.
    Reply With Quote Edit / Delete Reply Windows 7 Lithuania Show Events Friendly Friendly x 1 (list)

  32. Post #352
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    I have exams next week so I have no time at all to develop anything right now. It'll have to wait.
    Reply With Quote Edit / Delete Reply Windows 7 Netherlands Show Events Informative Informative x 1 (list)

  33. Post #353

    February 2011
    105 Posts
    Hello everyone, I just created a pick with this tool is super well done, but when I put in my code its not working, here is the code for my weapon:
    if (SERVER) then
    AddCSLuaFile( "shared.lua" )
    SWEP.Weight = 5
    SWEP.AutoSwitchTo = false
    SWEP.AutoSwitchFrom = false
    end

    if ( CLIENT ) then
    SWEP.PrintName = "Pickaxe"
    SWEP.Author = "Lyc@n"
    SWEP.Contact = ""
    SWEP.DrawAmmo = false
    SWEP.DrawCrosshair = false
    SWEP.ViewModelFOV = 70
    SWEP.ViewModelFlip = false
    SWEP.ShowViewModel = false
    SWEP.ShowWorldModel = false
    SWEP.ViewModelBonescales = {}
    SWEP.HoldType = "melee"
    SWEP.CSMuzzleFlashes = false
    end

    SWEP.Category = "RP Weapons"
    SWEP.Spawnable = true
    SWEP.AdminSpawnable = true

    SWEP.ViewModel = "models/Weapons/V_Stunbaton.mdl"
    SWEP.WorldModel = "models/weapons/W_stunbaton.mdl"

    SWEP.IronSightsPos = Vector(-6.921, 8.319, 7.4)
    SWEP.IronSightsAng = Vector(0, 0, 0)

    SWEP.VElements = {
    ["vpickaxe"] = { type = "Model", model = "models/props_mining/pickaxe01.mdl", bone = "Dummy15", rel = "", pos = Vector(-8.568, 1.113, -30), angle = Angle(0.699, 149, -0.094), size = Vector(1.166, 1.552, 1.166), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
    }
    SWEP.WElements = {
    ["wpickaxe"] = { type = "Model", model = "models/props_mining/pickaxe01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(1.486, 0.749, 3.819), angle = Angle(-163.857, -12.231, 3.275), size = Vector(0.762, 0.762, 0.762), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
    }

    SWEP.Primary.ClipSize = 1
    SWEP.Primary.DefaultClip = 1
    SWEP.Primary.Automatic = false

    SWEP.Secondary.ClipSize = 0
    SWEP.Secondary.DefaultClip = 0

    function SWEP:Reload()
    end

    function SWEP:PrimaryAttack()
    end

    function SWEP:SecondaryAttack()
    end

    function SWEP:Think()
    end

    function SWEP:Initialize()

    self.HoldType = "melee" //Sets their holdtype to that of the AR2
    self:SetWeaponHoldType( self.HoldType )

    end
    If you want, that's what gave me the tool without the rest of the code:
    SWEP.HoldType = "melee"
    SWEP.ViewModelFOV = 70
    SWEP.ViewModelFlip = false
    SWEP.ViewModel = "models/Weapons/V_Stunbaton.mdl"
    SWEP.WorldModel = "models/weapons/W_stunbaton.mdl"
    SWEP.ShowViewModel = false
    SWEP.ShowWorldModel = false
    SWEP.ViewModelBonescales = {}

    SWEP.IronSightsPos = Vector(-6.921, 8.319, 7.4)
    SWEP.IronSightsAng = Vector(0, 0, 0)

    SWEP.VElements = {
    ["vpickaxe"] = { type = "Model", model = "models/props_mining/pickaxe01.mdl", bone = "Dummy15", rel = "", pos = Vector(-8.568, 1.113, -30), angle = Angle(0.699, 149, -0.094), size = Vector(1.166, 1.552, 1.166), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
    }
    SWEP.WElements = {
    ["wpickaxe"] = { type = "Model", model = "models/props_mining/pickaxe01.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(1.486, 0.749, 3.819), angle = Angle(-163.857, -12.231, 3.275), size = Vector(0.762, 0.762, 0.762), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
    }
    Can anyone tell me what you it is necessary in the code or fix it? Thank you!

  34. Post #354
    Gold Member
    Clavus's Avatar
    September 2009
    6,043 Posts
    The SWEP.VElements and SWEP.WElements tables won't do a thing without the base code (shown in the OP). Make sure you copy that in there too.

  35. Post #355

    February 2011
    105 Posts
    OK, thanks for your help!

  36. Post #356
    Snip, nvm

  37. Post #357
    cam64DD's Avatar
    November 2008
    778 Posts
    Okay, so I'm trying to make a swep here. Thing is, it simply doesn't pop up in the weapons tab. The shared.lua:

    CHECK THE POST DOWN THERE

    It is inside addons/testgun/lua. It is the only file in the folder.

    Any ideas ? :smith:

  38. Post #358
    next time use Code tags when you're posting a long lua code.
    I can't really tell if you put something in the code wrong because of the format (like I said, code tags)

    Code:
    if (SERVER) then
    AddCSLuaFile( "shared.lua" )
    
    // Show debug info?
    local debug = true
    
    //----------------------------------------------
    //Author Info
    //----------------------------------------------
    SWEP.PrintName = "KI Stormer 9mm"
    SWEP.Author = "Kenyan Industries"
    SWEP.Contact = "camirving@hotmail.com"
    SWEP.Purpose = "Self-defense."
    SWEP.Instructions = "Squeeze trigger"
    SWEP.Category = "Borderhoppers"
    //----------------------------------------------
    
    SWEP.Spawnable = true
    SWEP.AdminSpawnable = true
    // First person Model
    SWEP.ViewModel = "models/weapons/v_pist_glock18.mdl"
    // Third Person Model
    SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl"
    // Weapon Details
    SWEP.Primary.Clipsize = 16
    SWEP.Primary.DefaultClip = 64
    SWEP.Primary.Automatic = true
    SWEP.Primary.Ammo = "pistol"
    SWEP.Secondary.Clipsize = -1
    SWEP.Secondary.DefaultClip = -1
    SWEP.Secondary.Automatic = false
    SWEP.Secondary.Ammo = "none"
    // Sound
    local ShootSound = Sound ("Weapon_FiveSeven.Single")
    
    
    //--------------------------------------------
    // Called when it reloads
    //--------------------------------------------
    function SWEP:Reload()
    if debug then
    print("Reload")
    // Shove your debugging code in here
    end
    
    // All reload code goes in here
    end
    
    
    //--------------------------------------------
    // Called each frame when the Swep is active
    //--------------------------------------------
    function SWEP:Think()
    
    end
    
    
    //--------------------------------------------
    // Called when the player Shoots
    //--------------------------------------------
    function SWEP:PrimaryAttack()
    if debug then
    print("Primary Attack")
    // Put Your debugging Code in here
    end
    
    // Any Code you want to be executed when the player uses primary attack goes in here
    self:EmitSound(ShootSound)
    end
    
    
    //--------------------------------------------
    // Called when the player Uses secondary attack
    //--------------------------------------------
    function SWEP:SecondaryAttack()
    if debug then
    print("Secondary Attack")
    // Put your debugging code in here
    end
    
    // Any Code you want to my executed when the player uses secondary attack goes in here
    self:EmitSound(ShootSound)
    end
    
    /**************************************************
    SWEP Construction Kit base code
    Created by Clavus
    Available for public use, thread at:
    facepunch.com/threads/1032378
    **************************************************/
    
    function SWEP:Initialize()
    
    // other initialize code goes here
    
    if CLIENT then
    
    self:CreateModels(self.VElements) // create viewmodels
    self:CreateModels(self.WElements) // create worldmodels
    
    // init view model bone build function
    self.BuildViewModelBones = function( s )
    if LocalPlayer():GetActiveWeapon() == self and self.ViewModelBonescales then
    for k, v in pairs( self.ViewModelBonescales ) do
    local bone = s:LookupBone(k)
    if (!bone) then continue end
    local m = s:GetBoneMatrix(bone)
    if (!m) then continue end
    m:Scale(v)
    s:SetBoneMatrix(bone, m)
    end
    end
    end
    
    end
    
    end
    
    
    function SWEP:OnRemove()
    
    // other onremove code goes here
    
    if CLIENT then
    self:RemoveModels()
    end
    
    end
    
    
    if CLIENT then
    
    SWEP.vRenderOrder = nil
    function SWEP:ViewModelDrawn()
    
    local vm = self.Owner:GetViewModel()
    if !ValidEntity(vm) then return end
    
    if (!self.VElements) then return end
    
    if vm.BuildBonePositions ~= self.BuildViewModelBones then
    vm.BuildBonePositions = self.BuildViewModelBones
    end
    
    if (self.ShowViewModel == nil or self.ShowViewModel) then
    vm:SetColor(255,255,255,255)
    else
    // we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called
    vm:SetColor(255,255,255,1)
    end
    
    if (!self.vRenderOrder) then
    
    // we build a render order because sprites need to be drawn after models
    self.vRenderOrder = {}
    
    for k, v in pairs( self.VElements ) do
    if (v.type == "Model") then
    table.insert(self.vRenderOrder, 1, k)
    elseif (v.type == "Sprite" or v.type == "Quad") then
    table.insert(self.vRenderOrder, k)
    end
    end
    
    end
    
    for k, name in ipairs( self.vRenderOrder ) do
    
    local v = self.VElements[name]
    if (!v) then self.vRenderOrder = nil break end
    
    local model = v.modelEnt
    local sprite = v.spriteMaterial
    
    if (!v.bone) then continue end
    
    local pos, ang = self:GetBoneOrientation( self.VElements, v, vm )
    
    if (!pos) then continue end
    
    if (v.type == "Model" and ValidEntity(model)) then
    
    model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z )
    ang:RotateAroundAxis(ang:Up(), v.angle.y)
    ang:RotateAroundAxis(ang:Right(), v.angle.p)
    ang:RotateAroundAxis(ang:Forward(), v.angle.r)
    
    model:SetAngles(ang)
    model:SetModelScale(v.size)
    
    if (v.material == "") then
    model:SetMaterial("")
    elseif (model:GetMaterial() != v.material) then
    model:SetMaterial( v.material )
    end
    
    if (v.skin and v.skin != model:GetSkin()) then
    model:SetSkin(v.skin)
    end
    
    if (v.bodygroup) then
    for k, v in pairs( v.bodygroup ) do
    if (model:GetBodygroup(k) != v) then
    model:SetBodygroup(k, v)
    end
    end
    end
    
    if (v.surpresslightning) then
    render.SuppressEngineLighting(true)
    end
    
    render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255)
    render.SetBlend(v.color.a/255)
    model:DrawModel()
    render.SetBlend(1)
    render.SetColorModulation(1, 1, 1)
    
    if (v.surpresslightning) then
    render.SuppressEngineLighting(false)
    end
    
    elseif (v.type == "Sprite" and sprite) then
    
    local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
    render.SetMaterial(sprite)
    render.DrawSprite(drawpos, v.size.x, v.size.y, v.color)
    
    elseif (v.type == "Quad" and v.draw_func) then
    
    local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
    ang:RotateAroundAxis(ang:Up(), v.angle.y)
    ang:RotateAroundAxis(ang:Right(), v.angle.p)
    ang:RotateAroundAxis(ang:Forward(), v.angle.r)
    
    cam.Start3D2D(drawpos, ang, v.size)
    v.draw_func( self )
    cam.End3D2D()
    
    end
    
    end
    
    end
    
    SWEP.wRenderOrder = nil
    function SWEP:DrawWorldModel()
    
    if (self.ShowWorldModel == nil or self.ShowWorldModel) then
    self:DrawModel()
    end
    
    if (!self.WElements) then return end
    
    if (!self.wRenderOrder) then
    
    self.wRenderOrder = {}
    
    for k, v in pairs( self.WElements ) do
    if (v.type == "Model") then
    table.insert(self.wRenderOrder, 1, k)
    elseif (v.type == "Sprite" or v.type == "Quad") then
    table.insert(self.wRenderOrder, k)
    end
    end
    
    end
    
    if (ValidEntity(self.Owner)) then
    bone_ent = self.Owner
    else
    // when the weapon is dropped
    bone_ent = self
    end
    
    for k, name in pairs( self.wRenderOrder ) do
    
    local v = self.WElements[name]
    if (!v) then self.wRenderOrder = nil break end
    
    local pos, ang
    
    if (v.bone) then
    pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent )
    else
    pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent, "ValveBiped.Bip01_R_Hand" )
    end
    
    if (!pos) then continue end
    
    local model = v.modelEnt
    local sprite = v.spriteMaterial
    
    if (v.type == "Model" and ValidEntity(model)) then
    
    model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z )
    ang:RotateAroundAxis(ang:Up(), v.angle.y)
    ang:RotateAroundAxis(ang:Right(), v.angle.p)
    ang:RotateAroundAxis(ang:Forward(), v.angle.r)
    
    model:SetAngles(ang)
    model:SetModelScale(v.size)
    
    if (v.material == "") then
    model:SetMaterial("")
    elseif (model:GetMaterial() != v.material) then
    model:SetMaterial( v.material )
    end
    
    if (v.skin and v.skin != model:GetSkin()) then
    model:SetSkin(v.skin)
    end
    
    if (v.bodygroup) then
    for k, v in pairs( v.bodygroup ) do
    if (model:GetBodygroup(k) != v) then
    model:SetBodygroup(k, v)
    end
    end
    end
    
    if (v.surpresslightning) then
    render.SuppressEngineLighting(true)
    end
    
    render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255)
    render.SetBlend(v.color.a/255)
    model:DrawModel()
    render.SetBlend(1)
    render.SetColorModulation(1, 1, 1)
    
    if (v.surpresslightning) then
    render.SuppressEngineLighting(false)
    end
    
    elseif (v.type == "Sprite" and sprite) then
    
    local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
    render.SetMaterial(sprite)
    render.DrawSprite(drawpos, v.size.x, v.size.y, v.color)
    
    elseif (v.type == "Quad" and v.draw_func) then
    
    local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
    ang:RotateAroundAxis(ang:Up(), v.angle.y)
    ang:RotateAroundAxis(ang:Right(), v.angle.p)
    ang:RotateAroundAxis(ang:Forward(), v.angle.r)
    
    cam.Start3D2D(drawpos, ang, v.size)
    v.draw_func( self )
    cam.End3D2D()
    
    end
    
    end
    
    end
    
    function SWEP:GetBoneOrientation( basetab, tab, ent, bone_override )
    
    local bone, pos, ang
    if (tab.rel and tab.rel != "") then
    
    local v = basetab[tab.rel]
    
    if (!v) then return end
    
    // Technically, if there exists an element with the same name as a bone
    // you can get in an infinite loop. Let's just hope nobody's that stupid.
    pos, ang = self:GetBoneOrientation( basetab, v, ent )
    
    if (!pos) then return end
    
    pos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
    ang:RotateAroundAxis(ang:Up(), v.angle.y)
    ang:RotateAroundAxis(ang:Right(), v.angle.p)
    ang:RotateAroundAxis(ang:Forward(), v.angle.r)
    
    else
    
    bone = ent:LookupBone(bone_override or tab.bone)
    
    if (!bone) then return end
    
    pos, ang = Vector(0,0,0), Angle(0,0,0)
    local m = ent:GetBoneMatrix(bone)
    if (m) then
    pos, ang = m:GetTranslation(), m:GetAngle()
    end
    
    if (ValidEntity(self.Owner) and self.Owner:IsPlayer() and
    ent == self.Owner:GetViewModel() and self.ViewModelFlip) then
    ang.r = -ang.r // Fixes mirrored models
    end
    
    end
    
    return pos, ang
    end
    
    function SWEP:CreateModels( tab )
    
    if (!tab) then return end
    
    // Create the clientside models here because Garry says we can't do it in the render hook
    for k, v in pairs( tab ) do
    if (v.type == "Model" and v.model and v.model != "" and (!ValidEntity(v.modelEnt) or v.createdModel != v.model) and
    string.find(v.model, ".mdl") and file.Exists ("../"..v.model) ) then
    
    v.modelEnt = ClientsideModel(v.model, RENDER_GROUP_VIEW_MODEL_OPAQUE)
    if (ValidEntity(v.modelEnt)) then
    v.modelEnt:SetPos(self:GetPos())
    v.modelEnt:SetAngles(self:GetAngles())
    v.modelEnt:SetParent(self)
    v.modelEnt:SetNoDraw(true)
    v.createdModel = v.model
    else
    v.modelEnt = nil
    end
    
    elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite)
    and file.Exists ("../materials/"..v.sprite..".vmt")) then
    
    local name = v.sprite.."-"
    local params = { ["$basetexture"] = v.sprite }
    // make sure we create a unique name based on the selected options
    local tocheck = { "nocull", "additive", "vertexalpha", "vertexcolor", "ignorez" }
    for i, j in pairs( tocheck ) do
    if (v[j]) then
    params["$"..j] = 1
    name = name.."1"
    else
    name = name.."0"
    end
    end
    
    v.createdSprite = v.sprite
    v.spriteMaterial = CreateMaterial(name,"UnlitGeneric",params)
    
    end
    end
    
    end
    
    function SWEP:OnRemove()
    self:RemoveModels()
    end
    
    function SWEP:RemoveModels()
    if (self.VElements) then
    for k, v in pairs( self.VElements ) do
    if (ValidEntity( v.modelEnt )) then v.modelEnt:Remove() end
    end
    end
    if (self.WElements) then
    for k, v in pairs( self.WElements ) do
    if (ValidEntity( v.modelEnt )) then v.modelEnt:Remove() end
    end
    end
    self.VElements = nil
    self.WElements = nil
    end
    
    end
    
    SWEP.HoldType = "pistol"
    SWEP.ViewModelFOV = 73
    SWEP.ViewModelFlip = true
    SWEP.ViewModel = "models/weapons/v_pist_glock18.mdl"
    SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl"
    SWEP.ShowViewModel = true
    SWEP.ShowWorldModel = true
    SWEP.ViewModelBonescales = {["v_weapon.Glock_Slide"] = Vector(0.009, 0.009, 0.009), ["v_weapon"] = Vector(1.075, 1.212, 1.075)}
    
    SWEP.IronSightsPos = Vector(4.4, 0, 1.279)
    SWEP.IronSightsAng = Vector(0.574, -0.575, 25.819)
    
    SWEP.VElements = {
    ["sight"] = { type = "Model", model = "models/items/Flare.mdl", bone = "v_weapon.Glock_Slide", rel = "", pos = Vector(-0.087, -0.082, -0.051), angle = Angle(0, 127, 0), size = Vector(0.5, 0.5, 0.5), color = Color(50, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },
    ["barrel"] = { type = "Model", model = "models/items/battery.mdl", bone = "v_weapon.Glock_Slide", rel = "", pos = Vector(-1.369, -0.375, 0), angle = Angle(12.137, 270, -90), size = Vector(0.493, 0.425, 1.197), color = Color(50, 250, 255, 255), surpresslightning = false, material = "gm_construct/wall_bottom", skin = 0, bodygroup = {} }
    }
    
    SWEP.WElements = {
    ["barrel"] = { type = "Model", model = "models/items/battery.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(12.906, 0.469, -4.087), angle = Angle(90, 0, 0), size = Vector(0.493, 0.425, 1.197), color = Color(50, 250, 255, 255), surpresslightning = false, material = "gm_construct/wall_bottom", skin = 0, bodygroup = {} }
    }
    I think you're missing the weapon base code in the beginning, I'm not sure though

    EDIT: or the fact that all the "ends" written in the code aren't spaced correctly

  39. Post #359
    cam64DD's Avatar
    November 2008
    778 Posts
    Code:
    if (SERVER) then
    AddCSLuaFile( "shared.lua" )
    
    // Show debug info?
    local debug = true
     
    //----------------------------------------------
    //Author Info
    //----------------------------------------------
    SWEP.PrintName          = "KI Stormer 9mm"
    SWEP.Author             = "piss"
    SWEP.Contact            = "camirving@hotmail.com"
    SWEP.Purpose            = "Self-defense."
    SWEP.Instructions       = "Squeeze trigger"
    SWEP.Category			= "piss"
    //----------------------------------------------
     
    SWEP.Spawnable = true
    SWEP.AdminSpawnable = true
    // First person Model
    SWEP.ViewModel = "models/weapons/v_pist_glock18.mdl"
    // Third Person Model
    SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl"
    // Weapon Details
    SWEP.Primary.Clipsize = 16
    SWEP.Primary.DefaultClip = 64
    SWEP.Primary.Automatic = true
    SWEP.Primary.Ammo = "pistol"
    SWEP.Secondary.Clipsize = -1
    SWEP.Secondary.DefaultClip = -1
    SWEP.Secondary.Automatic = false
    SWEP.Secondary.Ammo = "none"
    // Sound
    local ShootSound = Sound ("Weapon_FiveSeven.Single")
     
     
    //--------------------------------------------
    // Called when it reloads 
    //--------------------------------------------
    function SWEP:Reload()
    	if debug then
    		print("Reload")
    		// Shove your debugging code in here
    	end
     
    	// All reload code goes in here
    end
     
     
    //--------------------------------------------
    // Called each frame when the Swep is active
    //--------------------------------------------
    function SWEP:Think()
     
    end
     
     
    //--------------------------------------------
    // Called when the player Shoots
    //--------------------------------------------
    function SWEP:PrimaryAttack()
    	if debug then
    		print("Primary Attack")
    		// Put Your debugging Code in here
    	end
     
    	// Any Code you want to be executed when the player uses primary attack goes in here
    	self:EmitSound(ShootSound)
    end
     
     
    //--------------------------------------------
    // Called when the player Uses secondary attack
    //--------------------------------------------
    function SWEP:SecondaryAttack()
    	if debug then
    		print("Secondary Attack")
    		// Put your debugging code in here
    	end
     
    	// Any Code you want to my executed when the player uses secondary attack goes in here
    	self:EmitSound(ShootSound)
    end
     
    /**************************************************
        SWEP Construction Kit base code
            Created by Clavus
        Available for public use, thread at:
           facepunch.com/threads/1032378
    **************************************************/
     
    function SWEP:Initialize()
     
        // other initialize code goes here
     
        if CLIENT then
         
            self:CreateModels(self.VElements) // create viewmodels
            self:CreateModels(self.WElements) // create worldmodels
             
            // init view model bone build function
            self.BuildViewModelBones = function( s )
                if LocalPlayer():GetActiveWeapon() == self and self.ViewModelBonescales then
                    for k, v in pairs( self.ViewModelBonescales ) do
                        local bone = s:LookupBone(k)
                        if (!bone) then continue end
                        local m = s:GetBoneMatrix(bone)
                        if (!m) then continue end
                        m:Scale(v)
                        s:SetBoneMatrix(bone, m)
                    end
                end
            end
             
        end
     
    end
     
     
    function SWEP:OnRemove()
         
        // other onremove code goes here
         
        if CLIENT then
            self:RemoveModels()
        end
         
    end
         
     
    if CLIENT then
     
        SWEP.vRenderOrder = nil
        function SWEP:ViewModelDrawn()
             
            local vm = self.Owner:GetViewModel()
            if !ValidEntity(vm) then return end
             
            if (!self.VElements) then return end
             
            if vm.BuildBonePositions ~= self.BuildViewModelBones then
                vm.BuildBonePositions = self.BuildViewModelBones
            end
     
            if (self.ShowViewModel == nil or self.ShowViewModel) then
                vm:SetColor(255,255,255,255)
            else
                // we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called
                vm:SetColor(255,255,255,1) 
            end
             
            if (!self.vRenderOrder) then
                 
                // we build a render order because sprites need to be drawn after models
                self.vRenderOrder = {}
     
                for k, v in pairs( self.VElements ) do
                    if (v.type == "Model") then
                        table.insert(self.vRenderOrder, 1, k)
                    elseif (v.type == "Sprite" or v.type == "Quad") then
                        table.insert(self.vRenderOrder, k)
                    end
                end
                 
            end
     
            for k, name in ipairs( self.vRenderOrder ) do
             
                local v = self.VElements[name]
                if (!v) then self.vRenderOrder = nil break end
             
                local model = v.modelEnt
                local sprite = v.spriteMaterial
                 
                if (!v.bone) then continue end
                 
                local pos, ang = self:GetBoneOrientation( self.VElements, v, vm )
                 
                if (!pos) then continue end
                 
                if (v.type == "Model" and ValidEntity(model)) then
     
                    model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z )
                    ang:RotateAroundAxis(ang:Up(), v.angle.y)
                    ang:RotateAroundAxis(ang:Right(), v.angle.p)
                    ang:RotateAroundAxis(ang:Forward(), v.angle.r)
     
                    model:SetAngles(ang)
                    model:SetModelScale(v.size)
                     
                    if (v.material == "") then
                        model:SetMaterial("")
                    elseif (model:GetMaterial() != v.material) then
                        model:SetMaterial( v.material )
                    end
                     
                    if (v.skin and v.skin != model:GetSkin()) then
                        model:SetSkin(v.skin)
                    end
                     
                    if (v.bodygroup) then
                        for k, v in pairs( v.bodygroup ) do
                            if (model:GetBodygroup(k) != v) then
                                model:SetBodygroup(k, v)
                            end
                        end
                    end
                     
                    if (v.surpresslightning) then
                        render.SuppressEngineLighting(true)
                    end
                     
                    render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255)
                    render.SetBlend(v.color.a/255)
                    model:DrawModel()
                    render.SetBlend(1)
                    render.SetColorModulation(1, 1, 1)
                     
                    if (v.surpresslightning) then
                        render.SuppressEngineLighting(false)
                    end
                     
                elseif (v.type == "Sprite" and sprite) then
                     
                    local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
                    render.SetMaterial(sprite)
                    render.DrawSprite(drawpos, v.size.x, v.size.y, v.color)
                     
                elseif (v.type == "Quad" and v.draw_func) then
                     
                    local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
                    ang:RotateAroundAxis(ang:Up(), v.angle.y)
                    ang:RotateAroundAxis(ang:Right(), v.angle.p)
                    ang:RotateAroundAxis(ang:Forward(), v.angle.r)
                     
                    cam.Start3D2D(drawpos, ang, v.size)
                        v.draw_func( self )
                    cam.End3D2D()
     
                end
                 
            end
             
        end
     
        SWEP.wRenderOrder = nil
        function SWEP:DrawWorldModel()
             
            if (self.ShowWorldModel == nil or self.ShowWorldModel) then
                self:DrawModel()
            end
             
            if (!self.WElements) then return end
             
            if (!self.wRenderOrder) then
     
                self.wRenderOrder = {}
     
                for k, v in pairs( self.WElements ) do
                    if (v.type == "Model") then
                        table.insert(self.wRenderOrder, 1, k)
                    elseif (v.type == "Sprite" or v.type == "Quad") then
                        table.insert(self.wRenderOrder, k)
                    end
                end
     
            end
             
            if (ValidEntity(self.Owner)) then
                bone_ent = self.Owner
            else
                // when the weapon is dropped
                bone_ent = self
            end
             
            for k, name in pairs( self.wRenderOrder ) do
             
                local v = self.WElements[name]
                if (!v) then self.wRenderOrder = nil break end
                 
                local pos, ang
                 
                if (v.bone) then
                    pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent )
                else
                    pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent, "ValveBiped.Bip01_R_Hand" )
                end
                 
                if (!pos) then continue end
                 
                local model = v.modelEnt
                local sprite = v.spriteMaterial
                 
                if (v.type == "Model" and ValidEntity(model)) then
     
                    model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z )
                    ang:RotateAroundAxis(ang:Up(), v.angle.y)
                    ang:RotateAroundAxis(ang:Right(), v.angle.p)
                    ang:RotateAroundAxis(ang:Forward(), v.angle.r)
     
                    model:SetAngles(ang)
                    model:SetModelScale(v.size)
                     
                    if (v.material == "") then
                        model:SetMaterial("")
                    elseif (model:GetMaterial() != v.material) then
                        model:SetMaterial( v.material )
                    end
                     
                    if (v.skin and v.skin != model:GetSkin()) then
                        model:SetSkin(v.skin)
                    end
                     
                    if (v.bodygroup) then
                        for k, v in pairs( v.bodygroup ) do
                            if (model:GetBodygroup(k) != v) then
                                model:SetBodygroup(k, v)
                            end
                        end
                    end
                     
                    if (v.surpresslightning) then
                        render.SuppressEngineLighting(true)
                    end
                     
                    render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255)
                    render.SetBlend(v.color.a/255)
                    model:DrawModel()
                    render.SetBlend(1)
                    render.SetColorModulation(1, 1, 1)
                     
                    if (v.surpresslightning) then
                        render.SuppressEngineLighting(false)
                    end
                     
                elseif (v.type == "Sprite" and sprite) then
                     
                    local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
                    render.SetMaterial(sprite)
                    render.DrawSprite(drawpos, v.size.x, v.size.y, v.color)
                     
                elseif (v.type == "Quad" and v.draw_func) then
                     
                    local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
                    ang:RotateAroundAxis(ang:Up(), v.angle.y)
                    ang:RotateAroundAxis(ang:Right(), v.angle.p)
                    ang:RotateAroundAxis(ang:Forward(), v.angle.r)
                     
                    cam.Start3D2D(drawpos, ang, v.size)
                        v.draw_func( self )
                    cam.End3D2D()
     
                end
                 
            end
             
        end
     
        function SWEP:GetBoneOrientation( basetab, tab, ent, bone_override )
             
            local bone, pos, ang
            if (tab.rel and tab.rel != "") then
                 
                local v = basetab[tab.rel]
                 
                if (!v) then return end
                 
                // Technically, if there exists an element with the same name as a bone
                // you can get in an infinite loop. Let's just hope nobody's that stupid.
                pos, ang = self:GetBoneOrientation( basetab, v, ent )
                 
                if (!pos) then return end
                 
                pos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
                ang:RotateAroundAxis(ang:Up(), v.angle.y)
                ang:RotateAroundAxis(ang:Right(), v.angle.p)
                ang:RotateAroundAxis(ang:Forward(), v.angle.r)
                     
            else
             
                bone = ent:LookupBone(bone_override or tab.bone)
     
                if (!bone) then return end
                 
                pos, ang = Vector(0,0,0), Angle(0,0,0)
                local m = ent:GetBoneMatrix(bone)
                if (m) then
                    pos, ang = m:GetTranslation(), m:GetAngle()
                end
                 
                if (ValidEntity(self.Owner) and self.Owner:IsPlayer() and
                    ent == self.Owner:GetViewModel() and self.ViewModelFlip) then
                    ang.r = -ang.r // Fixes mirrored models
                end
             
            end
             
            return pos, ang
        end
     
        function SWEP:CreateModels( tab )
     
            if (!tab) then return end
     
            // Create the clientside models here because Garry says we can't do it in the render hook
            for k, v in pairs( tab ) do
                if (v.type == "Model" and v.model and v.model != "" and (!ValidEntity(v.modelEnt) or v.createdModel != v.model) and
                        string.find(v.model, ".mdl") and file.Exists ("../"..v.model) ) then
                     
                    v.modelEnt = ClientsideModel(v.model, RENDER_GROUP_VIEW_MODEL_OPAQUE)
                    if (ValidEntity(v.modelEnt)) then
                        v.modelEnt:SetPos(self:GetPos())
                        v.modelEnt:SetAngles(self:GetAngles())
                        v.modelEnt:SetParent(self)
                        v.modelEnt:SetNoDraw(true)
                        v.createdModel = v.model
                    else
                        v.modelEnt = nil
                    end
                     
                elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite) 
                    and file.Exists ("../materials/"..v.sprite..".vmt")) then
                     
                    local name = v.sprite.."-"
                    local params = { ["$basetexture"] = v.sprite }
                    // make sure we create a unique name based on the selected options
                    local tocheck = { "nocull", "additive", "vertexalpha", "vertexcolor", "ignorez" }
                    for i, j in pairs( tocheck ) do
                        if (v[j]) then
                            params["$"..j] = 1
                            name = name.."1"
                        else
                            name = name.."0"
                        end
                    end
     
                    v.createdSprite = v.sprite
                    v.spriteMaterial = CreateMaterial(name,"UnlitGeneric",params)
                     
                end
            end
             
        end
     
        function SWEP:OnRemove()
            self:RemoveModels()
        end
     
        function SWEP:RemoveModels()
            if (self.VElements) then
                for k, v in pairs( self.VElements ) do
                    if (ValidEntity( v.modelEnt )) then v.modelEnt:Remove() end
                end
            end
            if (self.WElements) then
                for k, v in pairs( self.WElements ) do
                    if (ValidEntity( v.modelEnt )) then v.modelEnt:Remove() end
                end
            end
            self.VElements = nil
            self.WElements = nil
        end
     
    end
    
    SWEP.HoldType = "pistol"
    SWEP.ViewModelFOV = 73
    SWEP.ViewModelFlip = true
    SWEP.ViewModel = "models/weapons/v_pist_glock18.mdl"
    SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl"
    SWEP.ShowViewModel = true
    SWEP.ShowWorldModel = true
    SWEP.ViewModelBonescales = {["v_weapon.Glock_Slide"] = Vector(0.009, 0.009, 0.009), ["v_weapon"] = Vector(1.075, 1.212, 1.075)}
    
    SWEP.IronSightsPos = Vector(4.4, 0, 1.279)
    SWEP.IronSightsAng = Vector(0.574, -0.575, 25.819)
    
    SWEP.VElements = {
    	["sight"] = { type = "Model", model = "models/items/Flare.mdl", bone = "v_weapon.Glock_Slide", rel = "", pos = Vector(-0.087, -0.082, -0.051), angle = Angle(0, 127, 0), size = Vector(0.5, 0.5, 0.5), color = Color(50, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },
    	["barrel"] = { type = "Model", model = "models/items/battery.mdl", bone = "v_weapon.Glock_Slide", rel = "", pos = Vector(-1.369, -0.375, 0), angle = Angle(12.137, 270, -90), size = Vector(0.493, 0.425, 1.197), color = Color(50, 250, 255, 255), surpresslightning = false, material = "gm_construct/wall_bottom", skin = 0, bodygroup = {} }
    }
    
    SWEP.WElements = {
    	["barrel"] = { type = "Model", model = "models/items/battery.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(12.906, 0.469, -4.087), angle = Angle(90, 0, 0), size = Vector(0.493, 0.425, 1.197), color = Color(50, 250, 255, 255), surpresslightning = false, material = "gm_construct/wall_bottom", skin = 0, bodygroup = {} }
    }

    WHAT NOW.

  40. Post #360
    I think you called "SWEP.ViewModel" and "SWEP.WorldModel" twice, but I don't think it would not make it work. Try removing the second set of Viewmodel and Worldmodel codes at the bottom, since you already have it at the top. Otherwise ask Clavus