add sborka
This commit is contained in:
77
garrysmod/lua/autorun/server/sv_admin_physics_fix.lua
Normal file
77
garrysmod/lua/autorun/server/sv_admin_physics_fix.lua
Normal file
@@ -0,0 +1,77 @@
|
||||
if not SERVER then return end
|
||||
|
||||
-- Таблица групп, которым разрешён административный доступ к Physgun
|
||||
local AdminGroups = {
|
||||
["superadmin"] = true,
|
||||
["super admin"] = true,
|
||||
["owner"] = true,
|
||||
["curator"] = true,
|
||||
["sudo-curator"] = true,
|
||||
["asist-sudo"] = true,
|
||||
["admin"] = true,
|
||||
["st.admin"] = true,
|
||||
["projectteam"] = true,
|
||||
["teh.admin"] = true,
|
||||
["ivent"] = true,
|
||||
["st.event"] = true,
|
||||
["event"] = true,
|
||||
["specadmin"] = true,
|
||||
["assistant"] = true,
|
||||
["disp"] = true,
|
||||
}
|
||||
|
||||
-- Хук для Physgun: позволяем администраторам поднимать энтити и игроков
|
||||
hook.Add("PhysgunPickup", "!!!!Admin_PhysgunPickup_Fix", function(ply, ent)
|
||||
if not IsValid(ply) then return end
|
||||
|
||||
local group = ply:GetUserGroup()
|
||||
if AdminGroups[group] then
|
||||
-- Если это игрок, SAM уже имеет свою логику, но мы подтверждаем наше разрешение
|
||||
if ent:IsPlayer() then
|
||||
-- Запрещаем поднимать суперадминов если мы просто "админ" (опционально)
|
||||
-- if group == "admin" and ent:IsSuperAdmin() then return false end
|
||||
return true
|
||||
end
|
||||
|
||||
-- Для всех остальных энтитей — разрешаем
|
||||
return true
|
||||
end
|
||||
end)
|
||||
|
||||
-- Хук для ToolGun: позволяем администраторам использовать инструменты на защищённых объектах
|
||||
hook.Add("CanTool", "!!!!Admin_CanTool_Fix", function(ply, tr, tool)
|
||||
if IsValid(ply) and AdminGroups[ply:GetUserGroup()] then
|
||||
return true
|
||||
end
|
||||
end)
|
||||
|
||||
-- Хук для Properties (ПКМ меню): позволяем администраторам видеть всё
|
||||
hook.Add("CanProperty", "!!!!Admin_CanProperty_Fix", function(ply, property, ent)
|
||||
if IsValid(ply) and AdminGroups[ply:GetUserGroup()] then
|
||||
return true
|
||||
end
|
||||
end)
|
||||
|
||||
-- Хук для Unfreeze: позволяем администраторам размораживать объекты
|
||||
hook.Add("CanPlayerUnfreeze", "!!!!Admin_CanPlayerUnfreeze_Fix", function(ply, ent, phys)
|
||||
if IsValid(ply) and AdminGroups[ply:GetUserGroup()] then
|
||||
return true
|
||||
end
|
||||
end)
|
||||
|
||||
-- Принудительная регистрация привилегий в CAMI для Helix и SAM
|
||||
hook.Add("InitPostEntity", "!!!!Admin_CAMI_Permissions_Fix", function()
|
||||
if CAMI then
|
||||
CAMI.RegisterPrivilege({
|
||||
Name = "Helix - Bypass Prop Protection",
|
||||
MinAccess = "admin"
|
||||
})
|
||||
|
||||
-- Для SAM
|
||||
if SAM_LOADED and sam then
|
||||
sam.permissions.add("can_physgun_players", nil, "admin")
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
print("[ADMIN FIX] Physics and Prop Protection bypass for 'admin' and 'curator' groups loaded.")
|
||||
5
garrysmod/lua/autorun/server/sv_disable_sprays.lua
Normal file
5
garrysmod/lua/autorun/server/sv_disable_sprays.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
-- Script to globally disable player sprays
|
||||
|
||||
hook.Add("PlayerSpray", "DisablePlayerSprays", function(ply)
|
||||
return true -- Returning true prevents the spray
|
||||
end)
|
||||
17
garrysmod/lua/autorun/server/sv_hostname_force.lua
Normal file
17
garrysmod/lua/autorun/server/sv_hostname_force.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
local ForceHostname = "FT 4.0 | Война на Украине | ВАЙП"
|
||||
|
||||
local function EnforceHostname()
|
||||
if GetConVar("hostname"):GetString() ~= ForceHostname then
|
||||
RunConsoleCommand("hostname", ForceHostname)
|
||||
end
|
||||
end
|
||||
|
||||
hook.Add("Think", "ForceHostnameAggressive", function()
|
||||
EnforceHostname()
|
||||
end)
|
||||
|
||||
timer.Create("ForceHostnameTimer", 0.1, 0, function()
|
||||
EnforceHostname()
|
||||
end)
|
||||
|
||||
EnforceHostname()
|
||||
35
garrysmod/lua/autorun/server/sv_lvs_health_entry_fix.lua
Normal file
35
garrysmod/lua/autorun/server/sv_lvs_health_entry_fix.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
if not SERVER then return end
|
||||
|
||||
-- MRP Fix: Disable entering LVS vehicles if health is below 0 or destroyed
|
||||
hook.Add( "LVS.CanPlayerDrive", "MRP_LVS_HealthFix", function( ply, vehicle )
|
||||
if not IsValid( vehicle ) then return end
|
||||
|
||||
-- Check if vehicle is destroyed or has negative health
|
||||
if vehicle.IsDestroyed and vehicle:IsDestroyed() then
|
||||
if not ply:IsAdmin() then
|
||||
ply:Notify("Техника уничтожена и не может управляться!")
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if vehicle.GetHP and vehicle:GetHP() <= 0 then
|
||||
if not ply:IsAdmin() then
|
||||
ply:Notify("Техника слишком сильно повреждена для эксплуатации!")
|
||||
return false
|
||||
end
|
||||
end
|
||||
end )
|
||||
|
||||
-- Prevents sitting in passenger seats of destroyed LVS vehicles
|
||||
hook.Add( "CanPlayerEnterVehicle", "MRP_LVS_SeatSafety", function( ply, vehicle )
|
||||
local lvsVehicle = vehicle.lvsGetVehicle and vehicle:lvsGetVehicle() or vehicle:GetParent()
|
||||
|
||||
if IsValid( lvsVehicle ) and lvsVehicle.LVS then
|
||||
if (lvsVehicle.IsDestroyed and lvsVehicle:IsDestroyed()) or (lvsVehicle.GetHP and lvsVehicle:GetHP() <= 0) then
|
||||
if not ply:IsAdmin() then
|
||||
ply:Notify("Техника уничтожена!")
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end )
|
||||
65
garrysmod/lua/autorun/server/sv_lvs_missile_fix.lua
Normal file
65
garrysmod/lua/autorun/server/sv_lvs_missile_fix.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
-- Фикс краша IVP от lvs_missile вылетающих за пределы карты
|
||||
-- IVP Failed at ivu_vhash.cxx 157 — физдвижок падает когда ракета улетает за map boundary
|
||||
-- Решение: отслеживаем lvs_missile и удаляем их до краша при выходе за пределы
|
||||
|
||||
if not SERVER then return end
|
||||
|
||||
-- Получаем границы карты при старте
|
||||
local mapMin, mapMax
|
||||
|
||||
hook.Add("InitPostEntity", "MRP_LVSMissileSafetyInit", function()
|
||||
local wMin, wMax = game.GetWorld():GetModelBounds()
|
||||
|
||||
-- Fallback for weird maps
|
||||
if not wMin or wMin == vector_origin then
|
||||
wMin = Vector(-16384, -16384, -16384)
|
||||
wMax = Vector(16383, 16383, 16383)
|
||||
end
|
||||
|
||||
-- margin 1000 instead of 2000 to be safer on small maps
|
||||
local margin = Vector(1000, 1000, 1000)
|
||||
mapMin = wMin + margin
|
||||
mapMax = wMax - margin
|
||||
|
||||
print("[MRP] LVS Missile Safety initialized. Bounds: " .. tostring(mapMin) .. " -> " .. tostring(mapMax))
|
||||
end)
|
||||
|
||||
-- Таймер мониторинга, не хук Think (чтобы не перегружать каждый тик)
|
||||
timer.Create("MRP_LVSMissileWatchdog", 0.1, 0, function()
|
||||
if not mapMin then return end
|
||||
|
||||
for _, ent in ipairs(ents.FindByClass("lvs_missile")) do
|
||||
if not IsValid(ent) then continue end
|
||||
|
||||
-- ЗАЩИТА 1: Не удаляем ракеты которые еще не инициализированы через Enable()
|
||||
if not ent.IsEnabled or not ent.SpawnTime then
|
||||
continue
|
||||
end
|
||||
|
||||
local pos = ent:GetPos()
|
||||
local age = CurTime() - ent.SpawnTime
|
||||
|
||||
-- ЗАЩИТА 2: Не удаляем ракеты моложе 1 сек (время на полную инициализацию)
|
||||
if age < 1 then
|
||||
continue
|
||||
end
|
||||
|
||||
-- Проверка 1: вышла за границы карты
|
||||
local outOfBounds = pos.x < mapMin.x or pos.x > mapMax.x
|
||||
or pos.y < mapMin.y or pos.y > mapMax.y
|
||||
or pos.z < mapMin.z or pos.z > mapMax.z
|
||||
|
||||
-- Проверка 2: координаты явно безумные (> 15000 = за пределами любой карты GMod)
|
||||
local crazyOrigin = pos:Length() > 15000
|
||||
|
||||
if outOfBounds or crazyOrigin then
|
||||
-- Безопасное удаление через SafeRemoveEntityDelayed
|
||||
-- НЕ вызываем Detonate() — это создаст взрыв в рандомной точке
|
||||
if ent.IsDetonated then continue end
|
||||
ent.IsDetonated = true
|
||||
|
||||
print("[Debug] Watchdog: Removing OOB missile age=" .. string.format("%.2f", age) .. "s at " .. tostring(pos))
|
||||
SafeRemoveEntityDelayed(ent, 0)
|
||||
end
|
||||
end
|
||||
end)
|
||||
80
garrysmod/lua/autorun/server/sv_spawn_protection.lua
Normal file
80
garrysmod/lua/autorun/server/sv_spawn_protection.lua
Normal file
@@ -0,0 +1,80 @@
|
||||
-- Script to prevent players from spawning inside each other
|
||||
-- Especially useful for MilitaryRP/Helix where many players spawn simultaneously
|
||||
|
||||
local UNSTUCK_TIMEOUT = 5 -- How many seconds we consider for unstuck logic
|
||||
local UNSTUCK_SEARCH_RADIUS = 300 -- Max search radius
|
||||
|
||||
local function IsPosEmpty(pos, filter)
|
||||
local trace = util.TraceHull({
|
||||
start = pos + Vector(0,0,10),
|
||||
endpos = pos + Vector(0,0,10),
|
||||
mins = Vector(-16, -16, 0),
|
||||
maxs = Vector(16, 16, 71),
|
||||
filter = filter
|
||||
})
|
||||
|
||||
if trace.Hit then return false end
|
||||
|
||||
-- Also check for other players explicitly (TraceHull filter might skip them if they are within each other)
|
||||
local entsNear = ents.FindInBox(pos + Vector(-16, -16, 0), pos + Vector(16, 16, 72))
|
||||
for _, v in pairs(entsNear) do
|
||||
if v:IsPlayer() and v:Alive() and v ~= filter then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local function FindSafePos(startPos, ply)
|
||||
if IsPosEmpty(startPos, ply) then return startPos end
|
||||
|
||||
-- Spiral search
|
||||
for r = 32, UNSTUCK_SEARCH_RADIUS, 32 do
|
||||
local steps = math.floor(r / 4)
|
||||
for i = 0, steps do
|
||||
local ang = (i / steps) * 360
|
||||
local offset = Angle(0, ang, 0):Forward() * r
|
||||
local tryPos = startPos + offset
|
||||
|
||||
if IsPosEmpty(tryPos, ply) then
|
||||
-- Ensure there is ground below
|
||||
local groundTrace = util.TraceLine({
|
||||
start = tryPos + Vector(0,0,50),
|
||||
endpos = tryPos - Vector(0,0,100),
|
||||
filter = ply
|
||||
})
|
||||
|
||||
if groundTrace.Hit then
|
||||
return groundTrace.HitPos
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return startPos
|
||||
end
|
||||
|
||||
hook.Add("PlayerSpawn", "Helix_AntiStuckSpawn", function(ply)
|
||||
-- Wait a frame for Helix to finish its set-spawn-point logic
|
||||
timer.Simple(0, function()
|
||||
if not IsValid(ply) or not ply:Alive() then return end
|
||||
|
||||
local currentPos = ply:GetPos()
|
||||
local safePos = FindSafePos(currentPos, ply)
|
||||
|
||||
if safePos ~= currentPos then
|
||||
ply:SetPos(safePos)
|
||||
end
|
||||
|
||||
-- Temporary NO COLLISION with other players for 3 seconds to avoid "jittery" physics if slightly overlapping
|
||||
ply:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER)
|
||||
timer.Create("Unstuck_CD_" .. ply:SteamID64(), 3, 1, function()
|
||||
if IsValid(ply) then
|
||||
ply:SetCollisionGroup(COLLISION_GROUP_PLAYER)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
print("[Anti-Stuck] Player spawn protection loaded")
|
||||
78
garrysmod/lua/autorun/server/sv_tacrp_att_fix.lua
Normal file
78
garrysmod/lua/autorun/server/sv_tacrp_att_fix.lua
Normal 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)
|
||||
Reference in New Issue
Block a user