mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-16 21:33:46 +03:00
41 lines
1.2 KiB
Lua
41 lines
1.2 KiB
Lua
--[[
|
|
| This file was obtained through the combined efforts
|
|
| of Madbluntz & Plymouth Antiquarian Society.
|
|
|
|
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
|
| Maloy, DrPepper10 @ RIP, Atle!
|
|
|
|
|
| Visit for more: https://plymouth.thetwilightzone.ru/
|
|
--]]
|
|
|
|
hook.Add("PopulateMenuBar", "ArcCW_NPCWeaponMenu", function (menubar)
|
|
local menu = menubar:AddOrGetMenu("ArcCW NPC Weapons")
|
|
|
|
menu:AddCVar("None", "gmod_npcweapon", "none")
|
|
menu:AddSpacer()
|
|
|
|
local weaponlist = weapons.GetList()
|
|
|
|
table.SortByMember(weaponlist, "PrintName", true)
|
|
|
|
local cats = {}
|
|
|
|
for _, k in pairs(weaponlist) do
|
|
if weapons.IsBasedOn(k.ClassName, "arccw_base") and !k.NotForNPCs and !k.PrimaryBash and k.Spawnable then
|
|
local cat = k.Category or "Other"
|
|
|
|
if !cats[cat] then cats[cat] = menu:AddSubMenu(cat) end
|
|
|
|
cats[cat]:SetDeleteSelf(false)
|
|
cats[cat]:AddCVar(k.PrintName, "gmod_npcweapon", k.ClassName)
|
|
end
|
|
end
|
|
end)
|
|
|
|
net.Receive("arccw_npcgiverequest", function(len, ply)
|
|
local class = GetConVar("gmod_npcweapon"):GetString()
|
|
|
|
net.Start("arccw_npcgivereturn")
|
|
net.WriteString(class)
|
|
net.SendToServer()
|
|
end) |