Making a Shield Weapon

Hi Guys !

I’ m making a shield weapon and i ‘ve finished almost every thing , but i have a problem … I’ ve my share.lua file and inside it i’ m putting fonction . But i need a fonction witch said : If the player is scoping the weapon , then he will not take damage, but if he is just holding the weapon with out scoping , he will take damage …

This is basicly what i need , if anyone know the fonction it would be helpfull ! Thanks !

lecel fonction MyFonction()

In the code for when they scope in, set a variable on the player. For example, in your secondary attack code you could do:
self.Owner.MyWeapon_IsScoped = true
And when they disable scoping set it to nil.

Then you add a hook on

GM/EntityTakeDamage, check for the variable, and if it’s true return true to block damage.