• Any help with my code?
    2 replies, posted
So before i paste my code in i want to say with the current code i get stuck on the chair, Can someone tell me what to change to make sure i do not get stuck on the gun? -- Information -- SWEP.PrintName = "Chair Thrower" -- Name of SWEP SWEP.Author = "JrLemonsHD" -- Author's Name SWEP.Instructions = "Left Click To Fire A Chair!" -- How to use SWEP -- Spawn Information -- SWEP.Spawnable = true -- Is it Spawnable? SWEP.AdminOnly = true -- Is it Admin Only? -- Clip Information -- SWEP.Primary.ClipSize = -1 -- Left Click Clip Size? SWEP.Primary.DefaultClip = -1 -- Left Click Default Clip Size SWEP.Primary.Automatic = true -- Automatic? SWEP.Primary.Ammo = "none" -- Left Click Ammo? SWEP.Secondary.ClipSize = -1 -- Right Click ClipSize? SWEP.Secondary.DefaultClip = -1 -- Right Click Default Clip Size SWEP.Secondary.Automatic = false -- Automatic? SWEP.Secondary.Ammo = "none" -- Right Click Ammo? -- More Information -- SWEP.Weight = 5 -- How much does it weigh? SWEP.AutoSwitchTo = false -- Auto Switch To When Spawned? SWEP.AutoSwitchFrom = false -- Auto Switch From It? SWEP.Slot = 1 -- Slot Number? SWEP.SlotPos = 2 -- Slot Position? SWEP.DrawAmmo = false -- Draw Ammo? SWEP.DrawCrosshair = true -- Make Crosshairs? -- Models -- SWEP.ViewModel = "models/weapons/v_pistol.mdl" -- What you see SWEP.WorldModel = "models/weapons/w_pistol.mdl" -- What other's see -- Sound Prechache -- local ShootSound = Sound ( "Metal.SawbladeStick" ) -- Prechache Sound, Used later on -- Chair Shoot On Left Click function SWEP:PrimaryAttack() -- Weapon is automatic. Function Call below defines firerate -- Set to shoot every 0.5 Seconds self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) -- Call "Throw Chair" on self with this model self:ThrowChair( "models/props/cs_office/Chair_office.mdl" ) end function SWEP:SecondaryAttack() -- Weapon is not automatic so no call needed. self:ThrowChair( "models/props_c17/FurnitureChair001a.mdl" ) end -- Custom Function function SWEP:ThrowChair( model_file ) -- Play the shoot that is precached self:EmitSound( ShootSound ) if ( CLIENT ) then return end -- Create prop_physics entity local ent = ents.Create( "prop_physics" ) -- Always make sure that created entities are actually created if ( !IsValid( ent ) ) then return end -- Set the entity's model ent:SetModel( model_file) -- Set the position to player's eye position plus 16 units forward. -- Sets the angles to the player's eye angles. Then spawn it. ent:SetPos( self.Owner:EyePos() + ( self.Owner:GetAimVector() * 16 ) ) ent:SetAngles( self.Owner:EyeAngles() ) ent:Spawn() -- Get Prop Physics local phys = ent:GetPhysicsObject() if ( !IsValid( phys ) ) then ent:Remove() return end -- Apply Force local velocity = self.Owner:GetAimVector() velocity = velocity * 100 velocity = velocity + ( VectorRand() * 10 ) -- Random Element phys:ApplyForceCenter( velocity ) -- This is just a random function in-case you are in sandbox mode! cleanup.Add( self.Owner, "props", ent ) undo.Create( "Thrown_Chair" ) undo.AddEntity( ent ) undo.SetPlayer ( self.Owner ) undo.Finish() end
Wrong subforum
Wrong section and please use [code] tags for ease thx [code] function RightSection( subforum ) if subforum == "Garry's Mod" then return true else return false end end[/code]
Sorry, you need to Log In to post a reply to this thread.