Skip to content

Commit

Permalink
Merge pull request #469 from Winkarst-cpu/business-config
Browse files Browse the repository at this point in the history
Add option to disable business in config
  • Loading branch information
alexgrist authored Jan 7, 2025
2 parents 9334896 + ffcb516 commit ae11869
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gamemode/config/sh_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
})
})
6 changes: 6 additions & 0 deletions gamemode/core/hooks/cl_hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions gamemode/core/hooks/sh_hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ae11869

Please sign in to comment.