• Nextbot Gun Problems
    1 replies, posted
So i made a nextbot that can hold a gun, but i'm running into some problems First off, i'm trying out some firebullets code, but it dosen't seem to actually fire bullets, even though the code seems to properly execute: [CODE]function ENT:FireWeapon() local wep = self.Weapon local muzzle = wep:LookupAttachment("muzzle") local muzzlepos = wep:GetAttachment(1) print(muzzlepos) local spread = .1 local shootPos = muzzlepos.Pos local bullet = {} bullet.Num = 1 bullet.Src = shootPos bullet.Dir = self:GetForward() -- ENT:GetAimVector() equivalent bullet.Spread = Vector( spread * 0.1 , spread * 0.1, 0) bullet.Tracer = 1 bullet.TracerName = "Tracer" bullet.Force = 20 bullet.Damage = 4 bullet.AmmoType = "Pistol" bullet.Callback = function(attacker, tr, dmginfo) dmginfo:SetDamageType(DMG_SHOCK) end wep:FireBullets(bullet) print("Fired bullets") end[/CODE] both print statements execute, and i get no errors and the second problem; is there a way to tell weapons to not be able to be picked up by the player? Because my Bot has an SMG, but if he tries to come into melee range, i pickup his SMG from his hands, and my bot's code derps up, because now it has no weapon to reference.
Use this hook and return false if the it's the nextbot's weapon, I believe that should work for the second problem [url]http://wiki.garrysmod.com/page/GM/AllowPlayerPickup[/url]
Sorry, you need to Log In to post a reply to this thread.