• Harpoon Gun Edit Help !
    9 replies, posted
Okay so i have the harpoon gun and it works perfectly but when i shoot the harpoons the ACTUAL harpoon that comes out and sticks to walls or npcs doesn't last longer than a couple seconds, it disappears really fast... is there any way i can increase the time that the harpoon stays on the map?
Look in the gun somewhere for remove() or something, and you should see a timer as well.
nope there isnt anything like that... weird.. cause before i posted i spent a lot of time looking at the coding trying to find something but there isnt. any other suggestions?
any one got any ideas?
Can you post the code/give me the link to the addon?
heres link : [url]http://www.garrysmod.org/downloads/?a=view&id=37074[/url] and code: [QUOTE] if ( SERVER ) then AddCSLuaFile( "shared.lua" ) SWEP.HoldType = "Pistol" end if ( CLIENT ) then SWEP.PrintName = "Harpoon Cannon" SWEP.Author = "Fijet" SWEP.Slot = 5 SWEP.SlotPos = 7 SWEP.ViewModelFOV = 62 SWEP.IconLetter = "x" end ------------General Swep Info--------------- SWEP.Author = "Fijet" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "Stick Some Combine To The Walls!" 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.5 --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 = true --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_junk/harpoon002a.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() * 1999999999999) 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_junk/watermelon01.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 -------------------------------------------------------------------[/QUOTE]
I believe what you are looking for is the line: bar:Fire("kill", "", 5) Basically, it's firing the "kill" input to the bar, with a delay of 5 (seconds?) Therefore, change the 5 to something higher, and voila. Or just remove that line, and they won't go away at all.
wow thanks Chris that worked... -___- i have been trying to find that forever THANK YOU SOOOOO MUCH :D
i didn't want to download the swep just to look at the code, i was 90% sure THAT was the line of code too :\
[QUOTE=sarmen123;19946357]wow thanks Chris that worked... -___- i have been trying to find that forever THANK YOU SOOOOO MUCH :D[/QUOTE] No problem, glad to help :)
Sorry, you need to Log In to post a reply to this thread.