add sborka

This commit is contained in:
2026-03-31 10:27:04 +03:00
commit f5e5f56c84
2345 changed files with 382127 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
-- Патч для tacrp_att: корректный подбор и возможность удаления суперадминами
-- Проблема: если free_atts = true, GiveAtt блокирует подбор с сообщением
-- "All attachments are free! This is not necessary!" и обвес не удаляется.
if not SERVER then return end
-- Таблица групп, имеющих админские права для поднятия сущностей
local AdminPrivs = {
["superadmin"] = true,
["curator"] = true,
["admin"] = true,
["owner"] = true,
["projectteam"] = true,
["teh.admin"] = true,
}
-- Ждём загрузки всех энтитей перед патчем
hook.Add("InitPostEntity", "MRP_PatchTacRPAtt", function()
-- Идём по всем зарегистрированным энтитям и патчим те, что начинаются на tacrp_att
for classname, meta in pairs(scripted_ents.GetList()) do
if string.StartWith(classname, "tacrp_att") and meta.t then
local ENT = meta.t
ENT.GiveAtt = function(self, ply)
if not self.AttToGive then return end
-- Проверка lock_atts: если включён и обвес уже есть — не выдаём
if TacRP and TacRP.ConVars and TacRP.ConVars["lock_atts"] and
TacRP.ConVars["lock_atts"]:GetBool() and
TacRP:PlayerGetAtts(ply, self.AttToGive) > 0 then
ply:PrintMessage(HUD_PRINTTALK, "У вас уже есть этот обвес!")
return
end
-- Выдаём обвес
if TacRP then
local given = TacRP:PlayerGiveAtt(ply, self.AttToGive, 1)
if given then
TacRP:PlayerSendAttInv(ply)
self:EmitSound("TacRP/weapons/flashlight_on.wav")
self:Remove()
end
end
end
-- Патчим Use чтобы не падал если TacRP не загружен
ENT.Use = function(self, ply)
if not ply:IsPlayer() then return end
self:GiveAtt(ply)
end
end
end
print("[MRP] tacrp_att patched: pickup fix applied to all derived attachments")
end)
-- Хук для удаления tacrp_att через physgun для суперадминов
hook.Add("PhysgunPickup", "MRP_AllowAttPickup", function(ply, ent)
if string.StartWith(ent:GetClass(), "tacrp_att") then
-- Разрешаем суперадминам поднимать и удалять обвесы
if ply:IsSuperAdmin() or AdminPrivs and AdminPrivs[ply:GetUserGroup()] then
return true
end
end
end)
-- Хук для удаления через ToolGun (суперадмин right-click)
hook.Add("CanTool", "MRP_AllowAttRemove", function(ply, tr, tool)
if tool == "remover" then
local ent = tr.Entity
if IsValid(ent) and string.StartWith(ent:GetClass(), "tacrp_att") then
if ply:IsSuperAdmin() or AdminPrivs and AdminPrivs[ply:GetUserGroup()] then
return true
end
end
end
end)