Weapon Problem


When i fire a weapon in my gamemode, it fires but it has no recoil and in the top left it says “Script errors”.
I checked my console and it said this error code:

[ERROR] gamemodes/applejack/entities/effects/rg_shelleject_rifle/init.lua:40: attempt to call method ‘SetAngle’ (a nil value)

  1. unknown - gamemodes/applejack/entities/effects/rg_shelleject_rifle/init.lua:40
  2. Effect - [C]:-1
  3. ShootEffects - gamemodes/applejack/entities/weapons/rg_base/shared.lua:836
  4. BaseAttack - gamemodes/applejack/entities/weapons/rg_base/shared.lua:572
  5. FireFunction - gamemodes/applejack/entities/weapons/rg_base/shared.lua:138
  6. unknown - gamemodes/applejack/entities/weapons/rg_base/shared.lua:939

What might be causing this error?

SetAngels not SetAngle.

Thank you, that was it indeed, but now i got another error code that has to do with the ammo.

[ERROR] gamemodes/applejack/entities/weapons/rg_base/shared.lua:427: table index is nil

  1. DoAmmoStuff - gamemodes/applejack/entities/weapons/rg_base/shared.lua:427
  2. unknown - gamemodes/applejack/entities/weapons/rg_base/shared.lua:489
  3. StripWeapon - [C]:-1
  4. HolsterAll - gamemodes/applejack/gamemode/metatables/sv_player.lua:878
  5. unknown - gamemodes/applejack/gamemode/hooks/sv_sandbox.lua:78

What should i do?

learn some lua or post your codes

Have a look at what assigns data to the table referenced on line 427 of shared.lua?

Reading errors is a simple skill which will take you a long way.

That’s why i asked, i checked that line in the file, but i don’t see anything wrong?

425 – Grab the ammo counts
426 self.previousOwner._Ammo = self.previousOwner._Ammo or {}
427 self.previousOwner._Ammo[self.Classname] = self.Weapon:Clip1();

Post the whole code and use code tags so we can look at it.

function SWEP:DoAmmoStuff()
	-- Get rid of pointles runs
	if CLIENT or not IsValid(self.previousOwner) then return end
	-- Grab the ammo counts
	self.previousOwner._Ammo = self.previousOwner._Ammo or {}
	self.previousOwner._Ammo[self.Classname] = self.Weapon:Clip1();
	-- Make sure that the weapon's clip is empty and the player doesn't have any more ammo to put in the clip
	if not (self.previousOwner._Ammo[self.Classname] == 0 and self.previousOwner:GetAmmoCount(self.Primary.Ammo) == 0)
	-- Make sure the player is alive
	or not  self.previousOwner:Alive()
	-- Make sure the player can actually put this weapon in their inventory
	or not  GAMEMODE.Items[self.Classname]
	-- Make sure we haven't done this already
	or		self.doneAmmoStuff
	-- Make sure the owner isn't already holstering
	or      self.previousOwner._Equipping
	then return end
	-- Set up a quick timer to remove the weapon
	timer.Simple(0, function()
		ammostuff(self.previousOwner, self.Classname);
	-- Stop the player managing to get multiple weapons in their inventory with quick button presses
	self.doneAmmoStuff = true

Ive got the same problem, can someone help?

You are using ( or rather trying to use ) an outdated addon.