local PLUGIN = PLUGIN if CLIENT then -- Данные NLR local nlrEndTime = 0 local inWarning = false local warningEndTime = 0 -- Шрифты surface.CreateFont("NLRTimer", { font = "Exo 2", size = 32, weight = 700 }) surface.CreateFont("NLRWarning", { font = "Exo 2", size = 48, weight = 700 }) -- Получение сетевых сообщений net.Receive("ixNLRStart", function() nlrEndTime = net.ReadFloat() inWarning = false warningEndTime = 0 end) net.Receive("ixNLREnd", function() nlrEndTime = 0 inWarning = false warningEndTime = 0 end) net.Receive("ixNLRWarning", function() inWarning = net.ReadBool() warningEndTime = net.ReadFloat() end) -- Отрисовка эффектов function PLUGIN:HUDPaint() local ply = LocalPlayer() if not IsValid(ply) or not ply:Alive() then return end local scrW, scrH = ScrW(), ScrH() local currentTime = CurTime() -- Если NLR активен if nlrEndTime > 0 and currentTime < nlrEndTime then local timeLeft = math.ceil(nlrEndTime - currentTime) local minutes = math.floor(timeLeft / 60) local seconds = timeLeft % 60 -- Таймер NLR local timerText = string.format("NLR: %02d:%02d", minutes, seconds) draw.SimpleText(timerText, "NLRTimer", scrW / 2, 50, Color(255, 200, 0), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP) end -- Если игрок вне зоны (предупреждение) if inWarning and warningEndTime > 0 then local warningTimeLeft = math.ceil(warningEndTime - currentTime) if warningTimeLeft > 0 then -- Красный экран local alpha = 100 + math.sin(currentTime * 5) * 50 surface.SetDrawColor(255, 0, 0, alpha) surface.DrawRect(0, 0, scrW, scrH) -- Рамка surface.SetDrawColor(255, 0, 0, 255) surface.DrawOutlinedRect(10, 10, scrW - 20, scrH - 20, 5) -- Предупреждение local warningText = "ВЕРНИТЕСЬ НА БАЗУ!" draw.SimpleText(warningText, "NLRWarning", scrW / 2, scrH / 2 - 50, Color(255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) -- Таймер предупреждения local warningTimerText = string.format("Осталось: %d секунд", warningTimeLeft) draw.SimpleText(warningTimerText, "NLRTimer", scrW / 2, scrH / 2 + 20, Color(255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end end end -- Отображение информации о зонах (для дебага) function PLUGIN:DrawNLRZones() if not GetConVar("developer"):GetBool() then return end local ply = LocalPlayer() if not IsValid(ply) then return end local char = ply:GetCharacter() if not char then return end local faction = char:GetFaction() local zones = self.config.zones[faction] if not zones then return end for _, zone in ipairs(zones) do -- Рисуем границы зоны (упрощенно) local corners = { Vector(zone.min.x, zone.min.y, zone.min.z), Vector(zone.max.x, zone.min.y, zone.min.z), Vector(zone.max.x, zone.max.y, zone.min.z), Vector(zone.min.x, zone.max.y, zone.min.z), Vector(zone.min.x, zone.min.y, zone.max.z), Vector(zone.max.x, zone.min.y, zone.max.z), Vector(zone.max.x, zone.max.y, zone.max.z), Vector(zone.min.x, zone.max.y, zone.max.z), } for i = 1, 4 do debugoverlay.Line(corners[i], corners[i % 4 + 1], 0.1, Color(0, 255, 0), true) debugoverlay.Line(corners[i + 4], corners[(i % 4 + 1) + 4], 0.1, Color(0, 255, 0), true) debugoverlay.Line(corners[i], corners[i + 4], 0.1, Color(0, 255, 0), true) end end end end