• Making a Shield Weapon
    2 replies, posted
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 !
[code] lecel fonction MyFonction() LePrint(MyFonction) end [/code]
[QUOTE=sifly_04;47235630] Hi guys! I m making a shield weapon and I've finished almost every thing, but I have a problem... I need to state that when a player is scoped in, they will not take damage. Thanks! [/QUOTE] In the code for when they scope in, set a variable on the player. For example, in your secondary attack code you could do: [lua] self.Owner.MyWeapon_IsScoped = true [/lua] And when they disable scoping set it to nil. Then you add a hook on [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/EntityTakeDamage]GM/EntityTakeDamage[/url], check for the variable, and if it's true return true to block damage.
Sorry, you need to Log In to post a reply to this thread.