• Holsterable Weapons
    10 replies, posted
Basically what I need is a way to have weapons on a player be holstered when not in use, in the same way NPCs have their weapons holstered (you know, when they aren't firing they hold their weapons like normal people would instead of always having them up and sighted) I know a few RP scripts have toggleable weapons console commands so you can go back and forth from having yourself aim them and letting them hang down. But I don't know how to take just that one part from the script, and nothing else.
[lua]function SWEP:Holster( wep ) return true end [/lua] [url]http://wiki.garrysmod.com/?title=SWEP.Holster[/url] Just add it to your swep's shared.lua
Thank you very much. I will put it in.
I haven't tested it tough, but if you have to believe the wiki it should do the job.
Yeah, I'm working on it but I'm not sure what to put in the ( wep ) part. On most of the shared luas there is no name specified to put in there. I don't know a whole lot about code so maybe I'll just wait for someone else to post here. [editline]Edited[/editline] I have found something similar to the code above. It is as follows: [lua]SWEP.CanHolster = true[/lua] Can anyone confirm if this will work as well? If so, how do I activate it ingame?
I dont know, but.. maybe on holster you could do a sendWeaponAnim:( "ACT_VM_HOLSTER" )
If I knew how to do that, I would try it. It seems to me that the bit of code maigel posted here works by switching to another weapon when not being fired. So I think that means I would need a weapon that is just the holstered animation? I don't know, like I said I don't know a whole lot about lua code.
I think he means [lua] function SWEP:Holster() self.Weapon:SendWeaponAnim( ACT_VM_HOLSTER ) return true end [/lua]
I'll try that one now. Would this mean a console command or something would let me holster it, or it would automatically holster when not shooting?
Bump. I know the answer here must be simple, I'm probably making a mountain out of a molehill.
Bump. This would be quite useful for myself as well.
Sorry, you need to Log In to post a reply to this thread.