Skip to content

Add CAMI support #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions addons/cami.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"title": "CAMI",
"type": "tool",
"tags": [],
"version": "20190102",
"include": [
"lua/autorun/sh_cami.lua"
],
"versionables": [
"sh_cami"
]
}
51 changes: 26 additions & 25 deletions addons/npc_spawn_platforms.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
{
"title": "NPC Spawn Platforms",
"author": "Lex Robinson",
"contact": "lexi@lexi.org.uk",
"type": "tool",
"tags": [
"fun",
"build"
],
"include": [
"resource/localization/*/moneypot.properties",
"lua/autorun/client/npcspawner2_cl.lua",
"lua/autorun/client/panel-npcselect.lua",
"lua/autorun/client/panel-weaponselect.lua",
"lua/autorun/npcspawner2.lua",
"lua/autorun/server/npcspawner2_sv.lua",
"lua/entities/sent_spawnplatform/*.lua",
"lua/weapons/gmod_tool/stools/npc_spawnplatform.lua"
],
"import": [
"base_lexentity"
],
"version": "3.2.0",
"workshopid": 107821465
}
{
"title": "NPC Spawn Platforms",
"author": "Lex Robinson",
"contact": "lexi@lexi.org.uk",
"type": "tool",
"tags": [
"fun",
"build"
],
"include": [
"resource/localization/*/moneypot.properties",
"lua/autorun/client/npcspawner2_cl.lua",
"lua/autorun/client/panel-npcselect.lua",
"lua/autorun/client/panel-weaponselect.lua",
"lua/autorun/npcspawner2.lua",
"lua/autorun/server/npcspawner2_sv.lua",
"lua/entities/sent_spawnplatform/*.lua",
"lua/weapons/gmod_tool/stools/npc_spawnplatform.lua"
],
"import": [
"base_lexentity",
"cami"
],
"version": "3.2.0",
"workshopid": 107821465
}
9 changes: 4 additions & 5 deletions lua/autorun/client/npcspawner2_cl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ local function cvar(id)
end

local function callback(cvar, old, new)
local lpl = LocalPlayer()
if (IsValid(lpl) and not lpl:IsAdmin()) then
return
end

local name = cvar:gsub(cvarstr, "")
local value = tonumber(new)

Expand Down Expand Up @@ -111,6 +106,10 @@ local function adminOptions(panel)
}
)

panel:AddControl(
"CheckBox", {Label = lang("cami"), Command = cvar("cami"), Help = true}
)

local dzpanel = panel:AddControl(
"ControlPanel", {Label = lang("dangerzone"), Closed = true}
)
Expand Down
17 changes: 17 additions & 0 deletions lua/autorun/npcspawner2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ _G.npcspawner = {
debug = 1,
sanity = 1,
rehydrate = 1,
cami = 1,
},
legacy = {
npc_citizen_medic = "Medic",
Expand All @@ -83,3 +84,19 @@ _G.npcspawner = {
npc_combine_p = "CombinePrison",
},
}

CAMI.RegisterPrivilege(
{
Name = "NPC Spawn Platforms",
Description = "spawn/duplicate the platforms",
MinAccess = "admin",
}
)

CAMI.RegisterPrivilege(
{
Name = "NPC Spawn Platforms Config",
Description = "change global config settings",
MinAccess = "admin",
}
)
12 changes: 10 additions & 2 deletions lua/autorun/server/npcspawner2_sv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,16 @@ end

concommand.Add(
"npcspawner_config", function(ply, _, args)
if (IsValid(ply) and not ply:IsAdmin()) then
return
if (IsValid(ply)) then
if (npcspawner.config.cami == 1) then
if (not CAMI.PlayerHasAccess(ply, "NPC Spawn Platforms Config")) then
return
end
else
if (not ply:IsAdmin()) then
return
end
end
end

local name, value = args[1], tonumber(args[2])
Expand Down
Loading