Making the gun shoot...

Can somebody help me put together a little bit of code that on primary fire, SWEP does it’s firing animation? My SWEP shoots fine, but I can’t get the firing animation to work. This is where it would GO…I believe, could somebody help me add the animations code? I may have used the wrong animation, since I originally had the model set to shotgun, and changed it to pistol…


function SWEP:PrimaryAttack()
self.Weapon:EmitSound("sounds/FOLDER/MYSWEP/MYSWEPShoot.wav")
self.Weapon:SetNextPrimaryFire(CurTime() + 0.2)
self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER)

give us the full code incase something else is messed up.

Do I smell a potential thief? :stalker:

i dont do that, i just want to see the whole thing, anyways, i dont think you need to animation script unless its custom, because most weapons that i have made work fine without that.

It IS custom, and I’m not posting it because I’m keeping it :siren:


TOP SECRET

:siren: until the pack’s release. I’m writing a movie script, and it has ONLY custom coded weapons and addons made especially for the movie by me or coders I specifically hired (Nothing I just got off of garrysmod.org). The movie will have some special SWEPS, maps, and other little bits that I’m going to release in a pack after the movie’s release. That’s why I’m not giving the code out, nor am I hosting servers with the maps in them. Only actors, coders, and behind-the-scenes guys have played around with the addons yet. Paranoia FTW!

[editline]08:59PM[/editline]

And nothing else is messed up. It all works fine, except for the lack of animation. The sounds work smoothly, and secondary fire works well, too.

MISSCENTER may be your problem here. Find the animation enumeration that corresponds to the weapon modle you have chosen.

I have absolutely no idea how to do that.

Unfortunately, I still have no idea what that means, and after about 2 days of research, I believe it is time for what you call a “bump”

If its a pistol then just put ACT_VM_PRIMARYATTACK
The one animation your using is for a melee type weapon.

How to find enumerations for lua.

http://filesmelt.com/dl/asdfadsf.jpg

http://filesmelt.com/dl/click1.jpg

http://filesmelt.com/dl/enutm.jpg

Find the anim you want and use its enumeration.