A loadout customization addon.
Go to file
StyledStrike a5978dad36
Merge pull request #9 from wrefgtzweve/patch-1
Add pregiveweapons hook
2024-11-08 20:19:02 -03:00
.github/workflows GLuaLint workflow adjustments 2022-11-19 20:58:24 -03:00
lua Add pregiveweapons hook 2024-11-09 00:16:41 +01:00
resource/localization Added Turkish Language 2023-12-02 20:32:39 +03:00
.editorconfig Prefer .editorconfig over vscode-specific settings 2023-01-06 22:27:07 -03:00
addon.json addon.json ignore .editorconfig 2023-01-06 22:28:12 -03:00
glualint.json glualint ignoreFiles tweak 2023-01-06 18:00:35 -03:00
LICENSE Initial commit 2022-07-06 15:51:54 -03:00
README.md Add preferred weapon override hook to README 2024-07-04 08:05:14 -03:00

Custom Loadout

A loadout customization addon for Garry's Mod.

GLuaLint Workshop Page

Features

  • Search weapons by name
  • Gives ammo to all weapons
  • Supports URS
  • Supports WUMA
  • Supports Builder-X
  • Server owners can set global ammo limits with custom_loadout_primary_limit and custom_loadout_secondary_limit
  • You can choose which weapon you prefer to hold when the loadout is applied

Developer Notes

If you want to blacklist weapons, you can either install and use URS/WUMA, or copy the example hook below and modify it as you wish.

-- Example: Only allow admins to use the Annabelle 
hook.Add('CustomLoadout.IsWeaponBlacklisted', 'cloadout_blacklist_example', function(ply, weaponClass)
    if weaponClass == 'weapon_annabelle' and not ply:IsAdmin() then
        return true
    end
end)

Returning true prevents the weapon from being given, and also marks them as unavailable on the loadout. Also, keep these in mind:

  • URS/WUMA/BuilderX/sandbox's PlayerGiveSWEP restrictions still apply even if this hook doesn't block a weapon
  • The hook must be added on a shared realm (both on CLIENT and SERVER)
  • It doesn't work in single player (so if you need to test it, do it on a local, peer-to-peer or dedicated server instead.)

You can also override which weapon is preferred by using this hook:

hook.Add( "CLoadoutOverridePreferredWeapon", "OverridePreferredWeaponExample", function( ply, preferredClass )
    -- With godmode, prefer to use the Physics Gun
    if ply:HasGodMode() then
        return "weapon_physgun"
    end

    -- You can return false instead to disable the automatic selection of
    -- a preferred weapon, allowing you to do custom logic after a loadout is given
    ply:Give( "weapon_physgun" )
    ply:SelectWeapon( "weapon_physgun" )

    return false
end )

Contributing

Please follow the CFC style guidelines before opening pull requests.