• Prop shooter ??
    5 replies, posted
Hey guys, i need some kind of thing where it can shoot cans. I tried the prop cannon but its broken atm. Can someone help me out, I need it for a machinima im doing.
Theres a swep called the harpoon cannon or something, its really simple but I took it and made it shoot turtles. :3
[url]http://wiki.garrysmod.com/?title=Chair_Throwing_SWEP[/url]
Thanks guys [editline]06:30AM[/editline] Guys thanks for helping me out here is my code : if ( SERVER ) then AddCSLuaFile( "shared.lua" ) SWEP.HoldType = "Pistol" end if ( CLIENT ) then SWEP.PrintName = "Cra0kalo Cannon" SWEP.Author = "Cra0kalo" SWEP.Slot = 5 SWEP.SlotPos = 7 SWEP.ViewModelFOV = 62 SWEP.IconLetter = "x" end ------------General Swep Info--------------- SWEP.Author = "Cra0kalo" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "Kill with cans" SWEP.Spawnable = true SWEP.AdminSpawnable = true ----------------------------------------------- ------------Models--------------------------- SWEP.ViewModel = "models/weapons/v_RPG.mdl" SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl" ----------------------------------------------- -------------Primary Fire Attributes---------------------------------------- SWEP.Primary.Delay = 0.9 --In seconds SWEP.Primary.Recoil = 0 --Gun Kick SWEP.Primary.Damage = 100 --Damage per Bullet SWEP.Primary.NumShots = 1 --Number of shots per one fire SWEP.Primary.Cone = 0 --Bullet Spread SWEP.Primary.ClipSize = 1 --Use "-1 if there are no clips" SWEP.Primary.DefaultClip = -1 --Number of shots in next clip SWEP.Primary.Automatic = false --Pistol fire (false) or SMG fire (true) SWEP.Primary.Ammo = "none" --Ammo Type -------------End Primary Fire Attributes------------------------------------ -------------Secondary Fire Attributes------------------------------------- SWEP.Secondary.Delay = 0.9 SWEP.Secondary.Recoil = 0 SWEP.Secondary.Damage = 100 SWEP.Secondary.NumShots = 1 SWEP.Secondary.Cone = 0 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = true SWEP.Secondary.Ammo = "none" -------------End Secondary Fire Attributes-------------------------------- -- function SWEP:Reload() --To do when reloading -- end function SWEP:Think() -- Called every frame end function SWEP:Initialize() util.PrecacheSound("physics/flesh/flesh_impact_bullet" .. math.random( 3, 5 ) .. ".wav") util.PrecacheSound("weapons/iceaxe/iceaxe_swing1.wav") end --------------------------------------------------------------------------- function SWEP:PrimaryAttack() self.Weapon:EmitSound("weapons/iceaxe/iceaxe_swing1.wav") self.Weapon:SetNextPrimaryFire(CurTime() + 0.1) self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER) if SERVER then local bar = ents.Create("prop_physics") bar:SetModel("models/props_cans/PepCan01a.mdl") bar:SetAngles(self.Owner:EyeAngles())-- Angle(0,90,0)) bar:SetPos(self.Owner:GetShootPos()) bar:SetOwner(self.Owner) bar:SetPhysicsAttacker(self.Owner) bar:Spawn() local phys = bar:GetPhysicsObject() phys:ApplyForceCenter(self.Owner:GetAimVector() * 1999999999) phys:AddAngleVelocity(Vector(0,5000000,0)) bar:Fire("kill", "", 5) end end --------------------------------------------------------------------------- --------------------------------------------------------------------------- function SWEP:SecondaryAttack() self.Weapon:EmitSound("weapons/iceaxe/iceaxe_swing1.wav") self.Weapon:SetNextSecondaryFire(CurTime() + 0.5) self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER) if SERVER then local bar = ents.Create("prop_physics") bar:SetModel("models/props/cs_office/Water_bottle.mdl") bar:SetAngles(self.Owner:EyeAngles())-- Angle(0,90,0)) bar:SetPos(self.Owner:GetShootPos()) bar:SetOwner(self.Owner) bar:SetPhysicsAttacker(self.Owner) bar:Spawn() local phys = bar:GetPhysicsObject() phys:ApplyForceCenter(self.Owner:GetAimVector() * 1999999999) phys:AddAngleVelocity(Vector(0,5000000,0)) bar:Fire("kill", "", 5) end end -------------------------------------------------------------------
Please for the love of god, use [noparse][lua][/lua][/noparse]
... Why would we want your code?
Sorry, you need to Log In to post a reply to this thread.