From ffcb5167b28cc0aa7776c42e9541c3a815715a66 Mon Sep 17 00:00:00 2001 From: Winkarst-cpu <74284083+Winkarst-cpu@users.noreply.github.com> Date: Tue, 7 Jan 2025 03:42:18 +0300 Subject: [PATCH] Business config --- gamemode/config/sh_config.lua | 5 ++++- gamemode/core/hooks/cl_hooks.lua | 6 ++++++ gamemode/core/hooks/sh_hooks.lua | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gamemode/config/sh_config.lua b/gamemode/config/sh_config.lua index c377e5157..2b3e4a237 100644 --- a/gamemode/config/sh_config.lua +++ b/gamemode/config/sh_config.lua @@ -164,6 +164,9 @@ ix.config.Add("weaponRaiseTime", 1, "The time it takes for a weapon to raise.", data = {min = 0.1, max = 60, decimals = 1}, category = "server" }) +ix.config.Add("allowBusiness", true, "Whether or not business is enabled.", nil, { + category = "server" +}) ix.config.Add("maxHoldWeight", 100, "The maximum weight that a player can carry in their hands.", nil, { data = {min = 1, max = 500}, category = "interaction" @@ -217,4 +220,4 @@ ix.config.Add("secondsPerMinute", 60, "How many seconds it takes for a minute to end, { data = {min = 0.01, max = 120}, category = "date" -}) +}) \ No newline at end of file diff --git a/gamemode/core/hooks/cl_hooks.lua b/gamemode/core/hooks/cl_hooks.lua index cea6431ac..cc66f309a 100644 --- a/gamemode/core/hooks/cl_hooks.lua +++ b/gamemode/core/hooks/cl_hooks.lua @@ -972,6 +972,12 @@ function GM:HUDDrawTargetID() return false end +function GM:BuildBusinessMenu() + if (!ix.config.Get("allowBusiness", true)) then + return false + end +end + gameevent.Listen("player_spawn") hook.Add("player_spawn", "ixPlayerSpawn", function(data) local client = Player(data.userid) diff --git a/gamemode/core/hooks/sh_hooks.lua b/gamemode/core/hooks/sh_hooks.lua index 41b045839..20963a100 100644 --- a/gamemode/core/hooks/sh_hooks.lua +++ b/gamemode/core/hooks/sh_hooks.lua @@ -124,6 +124,10 @@ function GM:TranslateActivity(client, act) end function GM:CanPlayerUseBusiness(client, uniqueID) + if (!ix.config.Get("allowBusiness", true)) then + return false + end + local itemTable = ix.item.list[uniqueID] if (!client:GetCharacter()) then