• Lua Error while shooting weapon on Deathrun
    6 replies, posted
When you shoot the weapon you get this error. [CODE] [ERROR] gamemodes/deathrun/entities/weapons/bobs_gun_base/shared.lua:308: attempt to index a nil value 1. ShootBullet - gamemodes/deathrun/entities/weapons/bobs_gun_base/shared.lua:308 2. ShootBulletInformation - gamemodes/deathrun/entities/weapons/bobs_gun_base/shared.lua:239 3. unknown - gamemodes/deathrun/entities/weapons/bobs_gun_base/shared.lua:162 [/CODE] I do not understand it lol. [editline]19th November 2013[/editline] Here is the code it is refering to. [CODE]-- Variables that are used on both client and server SWEP.Category = "" SWEP.Gun = "" SWEP.Author = "Generic Default, Worshipper, Clavus, and Bob" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "" SWEP.MuzzleAttachment = "1" -- Should be "1" for CSS models or "muzzle" for hl2 models SWEP.DrawCrosshair = true -- Hell no, crosshairs r 4 nubz! SWEP.ViewModelFOV = 65 -- How big the gun will look SWEP.ViewModelFlip = true -- True for CSS models, False for HL2 models SWEP.Spawnable = false SWEP.AdminSpawnable = false SWEP.Primary.Sound = Sound("") -- Sound of the gun SWEP.Primary.Round = ("") -- What kind of bullet? SWEP.Primary.Cone = 0.2 -- Accuracy of NPCs SWEP.Primary.Recoil = 10 SWEP.Primary.Damage = 10 SWEP.Primary.Spread = .01 --define from-the-hip accuracy (1 is terrible, .0001 is exact) SWEP.Primary.NumShots = 1 SWEP.Primary.RPM = 0 -- This is in Rounds Per Minute SWEP.Primary.ClipSize = 0 -- Size of a clip SWEP.Primary.DefaultClip = 0 -- Default number of bullets in a clip SWEP.Primary.KickUp = 0 -- Maximum up recoil (rise) SWEP.Primary.KickDown = 0 -- Maximum down recoil (skeet) SWEP.Primary.KickHorizontal = 0 -- Maximum side recoil (koolaid) SWEP.Primary.Automatic = true -- Automatic/Semi Auto SWEP.Primary.Ammo = "none" -- What kind of ammo SWEP.Secondary.ClipSize = 0 -- Size of a clip SWEP.Secondary.DefaultClip = 0 -- Default number of bullets in a clip SWEP.Secondary.Automatic = false -- Automatic/Semi Auto SWEP.Secondary.Ammo = "none" SWEP.Secondary.IronFOV = 0 -- How much you 'zoom' in. Less is more! SWEP.Penetration = true SWEP.Ricochet = true SWEP.MaxRicochet = 1 SWEP.RicochetCoin = 1 SWEP.BoltAction = false SWEP.Scoped = false SWEP.ShellTime = .35 SWEP.Tracer = 0 SWEP.CanBeSilenced = false SWEP.Silenced = false SWEP.NextSilence = 0 SWEP.SelectiveFire = false SWEP.NextFireSelect = 0 SWEP.IronSightsPos = Vector (2.4537, 1.0923, 0.2696) SWEP.IronSightsAng = Vector (0.0186, -0.0547, 0) SWEP.VElements = {} SWEP.WElements = {} function SWEP:Initialize() self.Reloadaftershoot = 0 -- Can't reload when firing self:SetWeaponHoldType(self.HoldType) self.Weapon:SetNetworkedBool("Reloading", false) if SERVER and self.Owner:IsNPC() then self:SetNPCMinBurst(3) self:SetNPCMaxBurst(10) -- None of this really matters but you need it here anyway self:SetNPCFireRate(1/(self.Primary.RPM/60)) self:SetCurrentWeaponProficiency( WEAPON_PROFICIENCY_VERY_GOOD ) end if CLIENT then -- // Create a new table for every weapon instance self.VElements = table.FullCopy( self.VElements ) self.WElements = table.FullCopy( self.WElements ) self.ViewModelBoneMods = table.FullCopy( self.ViewModelBoneMods ) self:CreateModels(self.VElements) -- create viewmodels self:CreateModels(self.WElements) -- create worldmodels -- // init view model bone build function if IsValid(self.Owner) and self.Owner:IsPlayer() then if self.Owner:Alive() then local vm = self.Owner:GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) -- // Init viewmodel visibility if (self.ShowViewModel == nil or self.ShowViewModel) then vm:SetColor(Color(255,255,255,255)) else -- // however for some reason the view model resets to render mode 0 every frame so we just apply a debug material to prevent it from drawing vm:SetMaterial("Debug/hsv") end end end end end if CLIENT then local oldpath = "vgui/hud/name" -- the path goes here local newpath = string.gsub(oldpath, "name", self.Gun) self.WepSelectIcon = surface.GetTextureID(newpath) end end function SWEP:Deploy() self:SetIronsights(false, self.Owner) -- Set the ironsight false if self.Silenced then self.Weapon:SendWeaponAnim( ACT_VM_DRAW_SILENCED ) else self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) end self.Weapon:SetNetworkedBool("Reloading", false) if !self.Owner:IsNPC() and self.Owner != nil then if self.ResetSights and self.Owner:GetViewModel() != nil then self.ResetSights = CurTime() + self.Owner:GetViewModel():SequenceDuration() end end return true end function SWEP:Holster() if CLIENT and IsValid(self.Owner) and not self.Owner:IsNPC() then local vm = self.Owner:GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) end end return true end function SWEP:OnRemove() if CLIENT and IsValid(self.Owner) and not self.Owner:IsNPC() then local vm = self.Owner:GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) end end end function SWEP:GetCapabilities() return CAP_WEAPON_RANGE_ATTACK1, CAP_INNATE_RANGE_ATTACK1 end function SWEP:Precache() util.PrecacheSound(self.Primary.Sound) util.PrecacheModel(self.ViewModel) util.PrecacheModel(self.WorldModel) end function SWEP:PrimaryAttack() if self:CanPrimaryAttack() and self.Owner:IsPlayer() then if !self.Owner:KeyDown(IN_SPEED) and !self.Owner:KeyDown(IN_RELOAD) then self:ShootBulletInformation() self.Weapon:TakePrimaryAmmo(1) if self.Silenced then self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK_SILENCED ) self.Weapon:EmitSound(self.Primary.SilencedSound) else self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) self.Weapon:EmitSound(self.Primary.Sound) end local fx = EffectData() fx:SetEntity(self.Weapon) fx:SetOrigin(self.Owner:GetShootPos()) fx:SetNormal(self.Owner:GetAimVector()) fx:SetAttachment(self.MuzzleAttachment) if GetConVar("M9KGasEffect") != nil then if GetConVar("M9KGasEffect"):GetBool() then util.Effect("m9k_rg_muzzle_rifle",fx) end end self.Owner:SetAnimation( PLAYER_ATTACK1 ) self.Owner:MuzzleFlash() self.Weapon:SetNextPrimaryFire(CurTime()+1/(self.Primary.RPM/60)) self:CheckWeaponsAndAmmo() self.RicochetCoin = (math.random(1,4)) if self.BoltAction then self:BoltBack() end end elseif self:CanPrimaryAttack() and self.Owner:IsNPC() then self:ShootBulletInformation() self.Weapon:TakePrimaryAmmo(1) self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) self.Weapon:EmitSound(self.Primary.Sound) self.Owner:SetAnimation( PLAYER_ATTACK1 ) self.Owner:MuzzleFlash() self.Weapon:SetNextPrimaryFire(CurTime()+1/(self.Primary.RPM/60)) self.RicochetCoin = (math.random(1,4)) end end function SWEP:CheckWeaponsAndAmmo() if SERVER and self.Weapon != nil and (GetConVar("M9KWeaponStrip"):GetBool()) then if self.Weapon:Clip1() == 0 && self.Owner:GetAmmoCount( self.Weapon:GetPrimaryAmmoType() ) == 0 then timer.Simple(.1, function() if SERVER then if not IsValid(self) then return end if self.Owner == nil then return end self.Owner:StripWeapon(self.Gun) end end) end end end /*--------------------------------------------------------- Name: SWEP:ShootBulletInformation() Desc: This func add the damage, the recoil, the number of shots and the cone on the bullet. ---------------------------------------------------------*/ function SWEP:ShootBulletInformation() local CurrentDamage local CurrentRecoil local CurrentCone if (self:GetIronsights() == true) and self.Owner:KeyDown(IN_ATTACK2) then CurrentCone = self.Primary.IronAccuracy else CurrentCone = self.Primary.Spread end local damagedice = math.Rand(.85,1.3) CurrentDamage = self.Primary.Damage * dam
And what line in that mess is 308?
if CLIENT and !game.SinglePlayer() and !self.Owner:IsNPC() then local anglo = Angle(math.Rand(-self.Primary.KickDown,-self.Primary.KickUp), math.Rand(-self.Primary.KickHorizontal,self.Primary.KickHorizontal), 0) local eyes = self.Owner:EyeAngles() eyes.pitch = eyes.pitch + (anglo.pitch/3) eyes.yaw = eyes.yaw + (anglo.yaw/3) if GetConVar("M9KDynamicRecoil"):GetBool() then self.Owner:SetEyeAngles(eyes) end end end the if convar part is 308
So the GetConVar("M9KDynamicRecoil") returns nil, which means that convar doesn't exist.
So should I just delete that line? lol
It's up to you how you go about fixing it. You can either remove that functionality, or create the convar.
It's not getting any easier for pro golfer Tiger Woods. In a bombshell revelation, Us Weekly reports a Los Angeles cocktail waitress says she has had a 31-month relationship with Woods. Jamie Grubbs claims she has voicemail messages to prove the ,[url=http://canadagooseparkajacket.webpaper.co/]http://canadagooseparkajacket.webpaper.co/[/url]. Grubbs, who is 24, told the publication she began having an affair with Woods, 33, in April 2007. Having rrecently appeared on VH1's Tool Academy,[url=http://canadagooseoutletssale.webpaper.co/]http://canadagooseoutletssale.webpaper.co/[/url], Grubbs says she has more than 300 racy texts from Woods, who wed model Elin Nordegren in 2004. Woods was involved in a strange one-car accident outside his Orlando home this weekend. It's believed that talk of an alleged affair with another woman -- New York City club manager Rachel Uchitel -- may have played a role in that crash. TMZ reports that Woods and his wife argued about an affair just before the crash. Meanwhile, Us Weekly says it will post some of the voicemails left by Woods starting Wednesday morning. ???????: [url=http://www.wiski.com/forum/index.php?showtopic=66084]http://www.wiski.com/forum/index.php?showtopic=66084[/url] [url=http://www.stanceworks.com/forums/showthread.php?p=1216915#post1216915]http://www.stanceworks.com/forums/showthread.php?p=1216915#post1216915[/url] [url=http://uvkrew.com/blog/view/388932/south-carolina-and-texas-aamp]http://uvkrew.com/blog/view/388932/south-carolina-and-texas-aamp[/url]
Sorry, you need to Log In to post a reply to this thread.