Skip to content

Instantly share code, notes, and snippets.

@Ethorbit
Last active July 27, 2026 22:29
Show Gist options
  • Select an option

  • Save Ethorbit/03fb42e61a147e7f537a74e3a19a9c75 to your computer and use it in GitHub Desktop.

Select an option

Save Ethorbit/03fb42e61a147e7f537a74e3a19a9c75 to your computer and use it in GitHub Desktop.
GLua guide on how to support the nZombies gamemode correctly

This is a Garry's Mod lua guide for addon authors on how to add support for nZombies gamemodes (such as the new nZombies Chronicles). It's very easy, but instead of a single comparison, you support several matches

1. Support any game that starts with nzombies:

This is the broadest and most future-proof method. It matches any gamemode whose name starts with "nzombies" including variants that don't exist yet.

local is_nzombies = string.StartsWith(string.lower(engine.ActiveGamemode()), "nzombies")
if is_nzombies then
    -- your special nzombies stuff
end

2. Support any variant of nZombies:

Similar to Method 1, but even more permissive. It matches any gamemode whose name contains "nzombies" anywhere in the string, not just at the start.

local is_nzombies = string.find(string.lower(engine.ActiveGamemode()), "nzombies") ~= nil
if is_nzombies then
    -- your special nzombies stuff
end

3. Support specific nZombies modes only:

Use this if you only want to support specific, known nZombies variants rather than all of them. This requires updating your addon manually whenever you want to add support for a new variant.

local nzombies = {
    ["nzombies"] = true,
    ["nzombies_chronicles"] = true,
    ["nzombies-unlimited"] = true
}

local is_nzombies = (nzombies[string.lower(engine.ActiveGamemode())] == true)
if is_nzombies then
    -- your special nzombies stuff
end

Here's an example of what NOT to do (it's a common mistake):

if engine.ActiveGamemode() == "nzombies" then

This only matches the original gamemode. It will break your addon on every other variant of nZombies, since their gamemode names are different strings entirely.

Don't do this. Use one of the methods above instead so your addon works across all nZombies variants, current and future.

The Reasoning

nZombies variants like nZombies Chronicles are built on the same underlying gamemode. They share most of the same functionality, and the biggest difference between them is simply the gamemode name itself.

Because of this, checking for an exact name match (like "nzombies") only catches the original gamemode and misses every variant. The methods above work around this by matching on the shared "nzombies" naming pattern instead of one exact name, so your addon correctly recognizes all variants of nZombies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment