• PlayerSwitchWeapon does not work client-side?
    2 replies, posted
I was trying to use the PlayerSwitchWeapon hook that is apparently shared, but it only works server-side and not client-side? Anyone have any idea why? I've also found if a player presses a key that is bound to "Swap to last weapon" it will work, but pressing any weapon keys/scrollwheel does not trigger the hook and I'm unsure why. [url]http://samuelmaddock.github.io/glua-docs/#?q=PlayerSwitch[/url] [url]http://wiki.garrysmod.com/page/GM/PlayerSwitchWeapon[/url] P.S. I am not using this in singleplayer.
It won't be called if the switching method is the "use" command or [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SelectWeapon]Player:SelectWeapon[/url], the proper way is to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/CUserCmd/SelectWeapon]CUserCmd:SelectWeapon[/url] clientside. [editline]22nd May 2015[/editline] Since you didn't tell us the gamemode I'm going to assume it's either TTT or Dark RP, which haven't been updated to this method since it's relatively new. [editline]22nd May 2015[/editline] And if you're wondering why, it's because those serverside methods essentially break [URL="http://wiki.garrysmod.com/page/Prediction"]prediction[/URL], which is of course why the hook is called clientside in the first place
[QUOTE=Jvs;47782461]It won't be called if the switching method is the "use" command or [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SelectWeapon]Player:SelectWeapon[/url], the proper way is to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/CUserCmd/SelectWeapon]CUserCmd:SelectWeapon[/url] clientside. [editline]22nd May 2015[/editline] Since you didn't tell us the gamemode I'm going to assume it's either TTT or Dark RP, which haven't been updated to this method since it's relatively new. [editline]22nd May 2015[/editline] And if you're wondering why, it's because those serverside methods essentially break [URL="http://wiki.garrysmod.com/page/Prediction"]prediction[/URL], which is of course why the hook is called clientside in the first place[/QUOTE] Ah thanks. Yeah, it's TTT.
Sorry, you need to Log In to post a reply to this thread.