Need a some help with my SWEP

I’m making a SWEP for personal use and i have some problems with the lua programming.

What kind of code do i use to make my weapon drop empty bullet cases just like smg1? Can i change the location of on-screen muzzle flash? Also, what code
defines either weapon reloads automatically after it runs out or not?

My weapon is also somehow a left hand version, something automatically switched it to left side and i don’t know what. Checked all the code and i can’t understand, what causes it :frowning:
The muzzle flash is still in the right side - by the way. I want my weapon to be on the right side of a screen again :frowning:

My lua is here, never mind about secondary fire. I generated this lua with some lua generator and changed values/names just to clear out.

you can change the orientation of the swep by using SWEP.ViewModelFlip and equaling that to false, but if it’s a CS:S model, they’re made for left-handed people for some reason you would need to flip them.

The bullet ejection is… wait.

The only way you can learn lua is to just jump right in. That’s how I had to do it. Just think logically, read a few guides, you’ll soon get disgusted as there’s no help on the internet.

The thing for the shell eject:


local fx = EffectData() -- fx is gonna equal EffectData() for sake of saving time and space.
            util.Effect(self.ShellEffect,fx) -- the effect

here, self.ShellEjectAttachment basically means SWEP.ShellEjectAttachment.
So if you put a variable at the first of the code that starts with SWEP.<something> it needs to be referenced in either the game base or the code below. Since it’s the plain old weapon_base, the vars you got all work, cause they’re linked.

Muzzleflashes also work by putting an effectdata block under the shooteffects function, but those are a bit harder.