It’s possible to have access to a Weapon in game by performing a hull trace and with its object (tr.Entity) I can check if it’s a Weapon and a SWEP, with the Entity:IsWeapon() and Weapon:IsScripted() method. So let’s suppose I have a Weapon object that is a SWEP how can I have access to the SWEP structure members through it?
When you’re creating a SWEP you add the values and functions to a SWEP structure (linked above) for example:
SWEP.Primary.Spread = 0.1
SWEP.Primary.NumberofShots = 1
SWEP.Primary.Automatic = false
SWEP.Primary.Recoil = 10
SWEP.Primary.Delay = 3
SWEP.Primary.Force = 1000
I’d like to have access to the values above through an Weapon object. For example, how can I access the SWEP.Primary.Spread through the object? I tried ent.Primary.Spread, but I had no success.