Discord
Steam
/
Garry's Mod
/
Help
/
Can't find my ..
Login/Join
Event Log
Can't find my SWEP in the Q menu
1 replies, posted
Search
In This Thread
Hello, I am trying to paste my Scripted weapon into GMod but I can't find it anywhere. Btw, I am a newbie to lua coding. This is what it looks like: [lua]if (SERVER) then AddCSLuaFile() SWEP.HoldType = "physgun" end if (CLIENT) then SWEP.Instructions = "test" SWEP.Purpose = "test" SWEP.Author = "test" SWEP.Contact = "test" SWEP.ViewModelFlip = false SWEP.DrawCrosshair = true SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.Category = "Other" SWEP.ShowViewModel = true SWEP.ShowWorldModel = true SWEP.ViewModelBoneMods = { ["Handle"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-19.049, -7.619, 19.048) } } * killicon.AddFont( "weapon_physcannon", "HL2MPTypeDeath", "-", Color( 255,80,0,255 ) ) SWEP.VElements = { ["4"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "Base", rel = "", pos = Vector(0.455, 1.399, 15.909), angle = Angle(-180, 129.886, -1.024), size = Vector(0.349, 0.349, 0.349), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/stasisshield_sheet", skin = 0, bodygroup = {} }, ["3+"] = { type = "Model", model = "models/gibs/gunship_gibs_nosegun.mdl", bone = "Base", rel = "", pos = Vector(5.908, 0.455, 4.091), angle = Angle(88.976, 148.294, -99.206), size = Vector(0.264, 0.264, 0.264), color = Color(255, 255, 255, 255), surpresslightning = false, material = "phoenix_storms/metalset_1-2", skin = 0, bodygroup = {} }, ["1+"] = { type = "Model", model = "models/props_c17/canister01a.mdl", bone = "Base", rel = "", pos = Vector(1.363, -3.182, 0.455), angle = Angle(-1.024, 1.023, -3.069), size = Vector(0.209, 0.209, 0.209), color = Color(214, 167, 146, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["1"] = { type = "Model", model = "models/props_c17/canister01a.mdl", bone = "Base", rel = "", pos = Vector(-0.456, -3.182, 0.455), angle = Angle(-1.024, 1.023, -3.069), size = Vector(0.209, 0.209, 0.209), color = Color(214, 167, 146, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["2"] = { type = "Model", model = "models/props_c17/gaspipes006a.mdl", bone = "Base", rel = "", pos = Vector(-6.818, 5.908, -7.728), angle = Angle(-91.024, 150.341, 95.113), size = Vector(0.435, 0.435, 0.435), color = Color(100, 100, 100, 255), surpresslightning = false, material = "environment maps/pipemetal001a", skin = 0, bodygroup = {} }, ["2+"] = { type = "Model", model = "models/props_c17/gaspipes006a.mdl", bone = "Base", rel = "", pos = Vector(7.3, 6.5, -7.728), angle = Angle(-91.024, 150.341, 27.614), size = Vector(0.435, 0.435, 0.435), color = Color(100, 100, 100, 255), surpresslightning = false, material = "environment maps/pipemetal001a", skin = 0, bodygroup = {} } } * SWEP.WElements = { ["4"] = { type = "Model", model = "models/props_c17/oildrum001.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(12.272, -1, -5), angle = Angle(-93.069, -19.432, -29.66), size = Vector(0.264, 0.264, 0.264), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/props_combine/stasisshield_sheet", skin = 0, bodygroup = {} }, ["1"] = { type = "Model", model = "models/props_c17/canister02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(12, -3.182, -8.301), angle = Angle(-93.069, 9.204, -1.024), size = Vector(0.151, 0.151, 0.151), color = Color(188, 137, 82, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["1+"] = { type = "Model", model = "models/props_c17/canister02a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(12.272, -1.364, -8.801), angle = Angle(-93.069, 9.204, -1.024), size = Vector(0.151, 0.151, 0.151), color = Color(195, 149, 82, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["3"] = { type = "Model", model = "models/gibs/gunship_gibs_nosegun.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(20.454, 1.363, -6.818), angle = Angle(-3.069, 11.25, -29.66), size = Vector(0.209, 0.209, 0.209), color = Color(255, 255, 255, 255), surpresslightning = false, material = "phoenix_storms/metalset_1-2", skin = 0, bodygroup = {} }, ["2"] = { type = "Model", model = "models/props_c17/gaspipes006a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8.635, 1.363, -0.456), angle = Angle(178.977, 37.84, -13.296), size = Vector(0.321, 0.321, 0.321), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["2+"] = { type = "Model", model = "models/props_c17/gaspipes006a.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(8.635, -0.456, -0), angle = Angle(170.794, 1.023, -15.341), size = Vector(0.321, 0.321, 0.321), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } * end SWEP.Base = "" SWEP.ViewModel = "models/weapons/v_physcannon.mdl" SWEP.WorldModel = "models/weapons/w_physics.mdl" SWEP.ViewModelFOV = 58.503937007874 SWEP.Primary.Recoil = 5 SWEP.Primary.Damage = 10 SWEP.Primary.NumShots = 4 SWEP.Primary.Delay = 1.0 SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = SWEP.Primary.ClipSize SWEP.Primary.Automatic = true SWEP.Primary.Cone = 0.04 SWEP.Primary.ConeMoving = 0.07 SWEP.Primary.ConeCrouching = 0.025 SWEP.MuzzleEffect = "silenced" SWEP.ShellEffect = "none" SWEP.WeaponType = "primary" SWEP.IronSightsPos = Vector(0.319, -1.811, 0.239) SWEP.IronSightsAng = Vector(1.929, 0.827, -0.276) local ShootSound = Sound("NPC_combine_gunship.gunship_weapon_fire_loop6") /*---------------------- Initialize -----------------------*/ function SWEP:Initialize() if SERVER then self:SetWeaponHoldType(self.HoldType) end self.Charging = false end /*---------------------- Reload ----------------------*/ function SWEP.Reload() end /*---------------------- Secondary ----------------------*/ function SWEP.SecondaryAttack self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay) self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay) if not self.CanPrimaryAttack() then return end self.Weapon:EmitSound(self.Primary.Sound) self.TakePrimaryAmmo(1) self:ShootStriderBullet(self.Primary.Damage, self.Primary.NumShots, self.Primary.Recoil, self.Primary.Cone) end /*---------------------- Base Code ----------------------*/ function SWEP:Initialize() // other initialize code goes here if CLIENT then // Create a new table for every weapon instance self.VElements = table.FullCopy( self.VElements ) self.WElements = table.FullCopy( self.WElements ) self.ViewModelBoneMods = table.FullCopy( self.ViewModelBoneMods ) self:CreateModels(self.VElements) // create viewmodels self:CreateModels(self.WElements) // create worldmodels // init view model bone build function if IsValid(self.Owner) then local vm = self.Owner:GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) // Init viewmodel visibility if (self.ShowViewModel == nil or self.ShowViewModel) then vm:SetColor(Color(255,255,255,255)) else // we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called vm:SetColor(Color(255,255,255,1)) // ^ stopped working in GMod 13 because you have to do Entity:SetRenderMode(1) for translucency to kick in // however for some reason the view model resets to render mode 0 every frame so we just apply a debug material to prevent it from drawing vm:SetMaterial("Debug/hsv") end end end end end function SWEP:Holster() if CLIENT and IsValid(self.Owner) then local vm = sel
Please use [noparse][lua][/lua][/noparse] tags when posting code on the forums.
Sorry, you need to
Log In
to post a reply to this thread.