Run all hooks except the gamemode hook.

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?

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.

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]

I don’t understand.


function GAMEMODE:DoPlayerDeath() .. end 

does override the gamemodes function.

:snip: I just re-read what was asked

Doesn’t that need to be ran after initialization?

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.


function GM:DoPlayerDeath()
     self.DoPlayerDeath = nil
end

Haters are hating already. If something looks stupid but it works it is not stupid. Now stop hating.