• Run all hooks except the gamemode hook.
    9 replies, posted
I'd like to override GM.DoPlayerDeath, but I'm not sure how to prevent the gamemode function from running while allowing all the other hooks to run. Does anyone know?
[QUOTE=thegrb93;48868050]I'd like to override GM.DoPlayerDeath, but I'm not sure how to prevent the gamemode function from running while allowing all the other hooks to run. Does anyone know?[/QUOTE] If you want to override it why would you not want the gamemode function to run? Just set it to whatever you want to override it with. If you don't actually care about the gamemode function you can always set it to an empty function.
[url]http://wiki.garrysmod.com/page/hook/Call[/url]
[QUOTE=Dinnanid;48868099]If you want to override it why would you not want the gamemode function to run? Just set it to whatever you want to override it with. If you don't actually care about the gamemode function you can always set it to an empty function.[/QUOTE] This is how I'm currently doing it, but I was hoping there would be a cleaner way to do it. [lua]hook.Add( "Initialize", "OverrideDeathHook", function() function GAMEMODE:DoPlayerDeath(...) end end)[/lua] [editline]9th October 2015[/editline] [QUOTE=Robotboy655;48868136][url]http://wiki.garrysmod.com/page/hook/Call[/url][/QUOTE] I don't understand.
[code]function GAMEMODE:DoPlayerDeath() .. end [/code] does override the gamemodes function.
:snip: I just re-read what was asked
[QUOTE=CoreWaffle;48868323][code]function GAMEMODE:DoPlayerDeath() .. end [/code] does override the gamemodes function.[/QUOTE] Doesn't that need to be ran after initialization?
[QUOTE=thegrb93;48868390]Doesn't that need to be ran after initialization?[/QUOTE] It needs to run after the gamemode loads so yes.
Okay I guess it's settled, I'll just set the gamemode function to do nothing.
Here is a nice but stupid way to do it. [CODE]function GM:DoPlayerDeath() self.DoPlayerDeath = nil end[/CODE] Haters are hating already. If something looks stupid but it works it is not stupid. Now stop hating.
Sorry, you need to Log In to post a reply to this thread.