Attempt to call field Create (nil value) - (SWEP) HELP!
0 replies, posted
Hi, I'm trying to make a SWEP but I'm getting a lua error "Attempt to call field Create (nil value)"
[code] function SWEP:SecondaryAttack()
if ( !self:CanSecondaryAttack() ) then return end
local eyetrace = self.Owner:GetEyeTrace()
self:EmitSound ( self.Secondary.Sound ) //Adds sound
self:ShootEffects()
local explode = ents.Create("env_explosion") //THIS IS THE LINE THAT IS CAUSING THE ERROR!
explode:SetPos( eyetrace.HitPos ) //Puts the explosion where you are aiming
explode:SetOwner( self.Owner ) //Sets the owner of the explosion
explode:Spawn()
explode:SetKeyValue("iMagnitude","175") //Sets the magnitude of the explosion
explode:Fire("Explode", 0, 0 ) //Tells the explode entity to explode
explode:EmitSound("weapon_AWP.Single", 1000, 1000 ) //Adds sound to the explosion
self:SetNextPrimaryFire( CurTime() + self.Secondary.Delay )
self:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
self:TakePrimaryAmmo(self.Secondary.TakeAmmo)
end [/code]
Sorry, you need to Log In to post a reply to this thread.