add sborka
This commit is contained in:
89
garrysmod/gamemodes/militaryrp/schema/cl_hooks.lua
Normal file
89
garrysmod/gamemodes/militaryrp/schema/cl_hooks.lua
Normal file
@@ -0,0 +1,89 @@
|
||||
function We(x)
|
||||
return x/1920*ScrW()
|
||||
end
|
||||
|
||||
function He(y)
|
||||
return y/1080*ScrH()
|
||||
end
|
||||
|
||||
function Schema:BuildBusinessMenu(panel)
|
||||
local bHasItems = false
|
||||
|
||||
for k, _ in pairs(ix.item.list) do
|
||||
if (hook.Run("CanPlayerUseBusiness", LocalPlayer(), k) != false) then
|
||||
bHasItems = true
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
return bHasItems
|
||||
end
|
||||
|
||||
function Schema:ScoreboardShow()
|
||||
if (LocalPlayer():GetCharacter() && !hook.Run("ShouldSuppressMenu", LocalPlayer())) then
|
||||
--vgui.Create("ixMenu")
|
||||
end
|
||||
|
||||
return "suppress"
|
||||
end
|
||||
|
||||
function Schema:SpawnMenuOpen()
|
||||
if not LocalPlayer():IsAdmin() then
|
||||
return false
|
||||
end
|
||||
|
||||
local ply = LocalPlayer()
|
||||
local isSuperAdmin = ply:IsSuperAdmin()
|
||||
|
||||
if ply:IsAdmin() and not isSuperAdmin then
|
||||
timer.Simple(0, function()
|
||||
local tabs = spawnmenu.GetCreationTabs()
|
||||
local tabsToHide = {
|
||||
["#spawnmenu.category.weapons"] = true,
|
||||
["#spawnmenu.category.npcs"] = true,
|
||||
["#spawnmenu.category.entities"] = true,
|
||||
["#spawnmenu.category.postprocess"] = true,
|
||||
["#spawnmenu.category.saves"] = true,
|
||||
["#spawnmenu.category.dupes"] = true
|
||||
}
|
||||
|
||||
for name, tab in pairs(tabs) do
|
||||
if tabsToHide[name] and IsValid(tab.Tab) then
|
||||
tab.Tab:SetVisible(false)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
-- Закрытие всех меню при смерти игрока
|
||||
function Schema:PlayerDeath(client)
|
||||
if client != LocalPlayer() then return end
|
||||
|
||||
-- Закрываем F4 меню
|
||||
local f4Plugin = ix.plugin.list["f4menu"]
|
||||
if f4Plugin and IsValid(f4Plugin.frame) then
|
||||
f4Plugin.frame:Remove()
|
||||
f4Plugin.frame = nil
|
||||
end
|
||||
|
||||
-- Закрываем pause menu
|
||||
local pausePlugin = ix.plugin.list["pause_menu"]
|
||||
if pausePlugin and IsValid(pausePlugin.menu) then
|
||||
pausePlugin.menu:Close()
|
||||
end
|
||||
|
||||
-- Закрываем scoreboard
|
||||
local scoreboardPlugin = ix.plugin.list["scoreboard"]
|
||||
if scoreboardPlugin and scoreboardPlugin.RemoveScoreboard then
|
||||
scoreboardPlugin:RemoveScoreboard()
|
||||
end
|
||||
|
||||
-- Закрываем все DFrames (на всякий случай)
|
||||
for _, panel in ipairs(vgui.GetWorldPanel():GetChildren()) do
|
||||
if IsValid(panel) and panel:GetClassName() == "DFrame" then
|
||||
panel:Close()
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user