44 lines
1.3 KiB
Lua
44 lines
1.3 KiB
Lua
local allowedTools = {
|
|
["remover"] = true,
|
|
["colour"] = true,
|
|
["camera"] = true,
|
|
["light"] = true,
|
|
["skeypads"] = true,
|
|
["material"] = true,
|
|
["textscreen"] = true,
|
|
["advdupe2"] = true,
|
|
["stacker_improved"] = true,
|
|
["nocollide"] = true,
|
|
["ledscreen"] = true,
|
|
["advmat"] = true,
|
|
["submaterial"] = true,
|
|
["permaprops"] = true,
|
|
}
|
|
|
|
hook.Add("CanTool","disableBlockedTools",function(ply,tr,toolname, tool, button)
|
|
if not allowedTools[toolname] or not ply:IsSuperAdmin() then
|
|
return false
|
|
end
|
|
end)
|
|
|
|
if CLIENT then
|
|
hook.Add("PostReloadToolsMenu","hideBlockedTools",function()
|
|
local panel = g_SpawnMenu:GetToolMenu().Items[1]
|
|
for _, val in ipairs(panel.Panel.List.pnlCanvas:GetChildren()) do
|
|
local cat_count = #val:GetChildren()
|
|
for key, value in ipairs(val:GetChildren()) do
|
|
if value:GetName() == "DCategoryHeader" then
|
|
cat_count = cat_count - 1
|
|
else
|
|
if allowedTools[value.Name] then continue end
|
|
value:Remove()
|
|
cat_count = cat_count - 1
|
|
end
|
|
|
|
if cat_count <= 0 then
|
|
val:Remove()
|
|
end
|
|
end
|
|
end
|
|
end)
|
|
end |