• Reloading Bar
    2 replies, posted
Hello there, I want to make a processing bar that only shows when the player is reloading. So when a player reloads a bar pops up and it's filling it self. And then dissapear when the player is done with reloading. Someone can help me with this? Thank you! Love love!
I think you need to hook into [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/DoAnimationEvent]GM:DoAnimationEvent[/url], check if the event is PLAYERANIMEVENT_RELOAD, and then use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/SequenceDuration]Entity:SequenceDuration[/url]
Unfortunately, it's not exactly easy since there is no "OnWeaponReloaded" hook, and it depends on each weapon's implementation of reloading. You could make it work for HL2 weapons by constantly checking the viewmodel sequence with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetSequence]Entity:GetSequence[/url] for ACT_VM_RELOAD with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetSequenceActivity]Entity:GetSequenceActivity[/url], and then use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetCycle]Entity:GetCycle[/url] on the viewmodel for progress. [editline]2nd September 2017[/editline] [QUOTE=MPan1;52639742]I think you need to hook into [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/DoAnimationEvent]GM:DoAnimationEvent[/url] and check if the event is one of the reload ones, and then get the sequence length[/QUOTE] That's only for player third-person reloading sequences, which don't use the same timing as first-person sequences. First-person/viewmodel is what's used to tell if the player can fire again.
Sorry, you need to Log In to post a reply to this thread.