I get this error when I shoot guns [lua][ERROR] gamemodes/darkrp/entities/weapons/bobs_gun_base/shared.lua:308: attempt to index a nil value
1. ShootBullet - gamemodes/darkrp/entities/weapons/bobs_gun_base/shared.lua:308
2. ShootBulletInformation - gamemodes/darkrp/entities/weapons/bobs_gun_base/shared.lua:239
3. unknown - gamemodes/darkrp/entities/weapons/bobs_gun_base/shared.lua:162[/lua]
Also [lua][ERROR] gamemodes/darkrp/entities/weapons/bobs_gun_base/shared.lua:203: attempt to index a nil value
1. CheckWeaponsAndAmmo - gamemodes/darkrp/entities/weapons/bobs_gun_base/shared.lua:203
2. unknown - gamemodes/darkrp/entities/weapons/bobs_gun_base/shared.lua:186[/lua]
Heres my bobs_gun_base shared.lua [lua]-- 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
Cu
I think you're supposed to be using bobs gun base with m9k.
make sure you have the autorun files with it
I have m9k heavey Weapons installed with this but I just tried reinstalling darkrp placed the lua files in the entities folder (autorun effects entities weapons) also I have the addon installed but still get the error.
[QUOTE=Handsome Matt;43510905]Hey. Good job ignoring me.[/QUOTE]
Why do you expect people in this section to understand what you're saying? I understand you're anti-spoonfeeding, but there's a difference between spoonfeeding and making no sense to them. He has no idea what to do about a missing convar or nil variable.
[QUOTE=Handsome Matt;43510905]Hey. Good job ignoring me.[/QUOTE]
oh crap sorry I didn't see your post I tried deleting the line but just end up getting a different error how would you say to fix it because I have the autorun file m9k_heavy_weaps which has [lua]if GetConVar("M9KDynamicRecoil") == nil then
CreateConVar("M9KDynamicRecoil", "1", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Use Aim-modifying recoil? 1 for true, 0 for false")
print("Recoil con var created")
end[/lua]
I believe it is server side and Recoil con var created doesn't print to console (client or server console)
Sorry, you need to Log In to post a reply to this thread.