• next_bot help
    0 replies, posted
Hi, I'm trying to get the following function to work: [lua] function ENT:PrimaryAttack() if !IsValid(self) || !IsValid(self.Weapon) then return; end local pos = self:GetPos(); local angles = self:GetForward(); local bullet = {}; bullet.Num = 1; bullet.Src = pos; bullet.Dir = angles; bullet.Spread = Vector( self.weaponspread * 0.1 , self.weaponspread * 0.1, 0); bullet.Tracer = 1; bullet.TracerName = "Tracer"; bullet.Force = 50; bullet.Damage = 18; bullet.AmmoType = "Pistol"; bullet.Callback = function(ply, tr, dmginfo) print("callback"); end; print(self:GetForward()); local tr = util.TraceLine(pos, angles * 1000, {self}); PrintTable(tr); self.Weapon:EmitSound("Weapon_SMG1.Single", 100, 100); self.Weapon:FireBullets(bullet); self.Weapon:MuzzleFlash(); --print("Fired bullets") end[/lua] Unfortunately when I print the tr table it returns this: [code]HitNonWorld = false HitGroup = 0 HitPos = 0.000000 0.000000 0.000000 FractionLeftSolid = 0 StartSolid = false Hit = false HitWorld = false SurfaceProps = 76 HitSky = true Normal = -0.000000 -0.000000 1.000000 PhysicsBone = 0 HitTexture = TOOLS/TOOLSSKYBOX HitNormal = 0.000000 0.000000 -1.000000 Entity = [NULL Entity] Fraction = 1 StartPos = 0.000000 0.000000 0.000000 HitNoDraw = false Y [/code] [editline]18th November 2013[/editline] bullet.Callback is also not being called...
Sorry, you need to Log In to post a reply to this thread.