Making a SWEP and need some help

Now I have the fileing system down I was just wondering if there is anyway, beside what the templates are doing:

function SWEP:PrimaryAttack()
	if ( !self:CanPrimaryAttack() ) then return end
	local bullet = {}
		bullet.Num = 1
		bullet.Src = self.Owner:GetShootPos()
		bullet.Dir = self.Owner:GetAimVector()
		bullet.Spread = Vector( 10* 0.1 , 10* 0.1, 0)
		bullet.Tracer = 0
		bullet.Force = 100
		bullet.Damage = 1000
		bullet.AmmoType = "AR2"
	local rnda = self.Primary.Recoil * -1
	local rndb = self.Primary.Recoil * math.random(-1, 1)
	self.Owner:FireBullets( bullet )
	self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) )
	self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
	self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )

Is there any other way of having a gun shoot? Because for some reason no matter what I set the damage to it seems to have the same effect, so I was wondering if there is any other way to make it do more damage.

Thanks in advance


I think that is the only way. Try changing “SWEP.Damage = 50”

BTW I know hardly anything about Lua so take precaution when following any advice that I give :smiley:

change this:
SWEP.Primary.Damage = 25
[/lua] to whatever damage you want.

I have tried to change the damage to a larger amount, but has no effect

Any suggestions?

And I was also wondering if there is any other way of defining a “bullet”, I have saw some people using

bullet:SetKeyValue ()

does anyone know how to use these?

That’s crap then. The bullet damage should change unless you aren’t restarting Gmod or using lua_reloadents
Or you’re just trolling (i doubt that ;])

Yeah, he’s right the damage should have changed. Make sure to restart Garrys Mod. If it doesn’t work I haven’t got a clue.

Haha what do you know, this WAS the problem! I actually forgot to restrt Gmod, oh well!


Haha what do you know, this WAS the problem! I actually forgot to restart Gmod, oh well!

Lol. At least you know :smiley:

Ha, good luck then :buddy: