local PLUGIN = PLUGIN PLUGIN.name = "Система Ивентов" PLUGIN.author = "Scripty & RefoselTeamWork" PLUGIN.description = "Продвинутая система ивентов с сужающейся зоной и кастомными спавнами." ix.config.Add("eventAllowedRanks", "superadmin,curator,ivent", "Ранги, которым разрешено управление ивентами (через запятую).", nil, { category = "Events" }) -- Shared Config (ported from sh_config.lua) PLUGIN.Config = { sounds = { event_start = "ambient/alarms/klaxon1.wav", event_end = "ambient/levels/citadel/citadel_hit.wav", player_join = "buttons/button15.wav" } } ix.util.Include("sv_plugin.lua") ix.util.Include("sv_doomsday.lua") ix.util.Include("cl_plugin.lua") ix.util.Include("cl_doomsday.lua") -- Commands Adaptation ix.command.Add("EventStart", { description = "Запустить стандартный боевой ивент.", privilege = "Manage Events", adminOnly = true, OnRun = function(self, client) if (PLUGIN.active) then return "Ивент уже активен!" end PLUGIN:StartEvent(client) return "Запуск ивента..." end }) ix.command.Add("EventStop", { description = "Остановить текущий активный ивент.", privilege = "Manage Events", adminOnly = true, OnRun = function(self, client) if (!PLUGIN.active) then return "Нет активного ивента для остановки!" end PLUGIN:EndEvent(client) return "Остановка ивента..." end }) ix.command.Add("EventOtkat", { description = "Отменить активный ивент с уведомлением.", privilege = "Manage Events", adminOnly = true, OnRun = function(self, client) if (!PLUGIN.active) then return "Нет активного ивента для отмены!" end PLUGIN:EndEvent(client, true) return "Отмена ивента..." end }) ix.command.Add("EventJoin", { description = "Присоединиться к активному ивенту.", OnRun = function(self, client) if (!PLUGIN.active) then return "Нет активного ивента для входа." end if (PLUGIN.participants[client:SteamID()]) then return "Вы уже участвуете!" end PLUGIN:AddParticipant(client) local participants_count = table.Count(PLUGIN.participants) PLUGIN:BroadcastMessage(string.format("%s присоединился к ивенту! Участников: %d", client:Nick(), participants_count)) end }) ix.command.Add("EventAddAll", { description = "Добавить всех игроков онлайн в ивент.", privilege = "Manage Events", adminOnly = true, OnRun = function(self, client) if (!PLUGIN.active) then return "Ивент не активен!" end PLUGIN:AddAllPlayers(client) end }) ix.command.Add("EventSetZone1", { description = "Установить первую точку зоны ивента.", privilege = "Manage Events", adminOnly = true, OnRun = function(self, client) PLUGIN:SetZonePoint1(client) end }) ix.command.Add("EventSetZone2", { description = "Установить вторую точку зоны ивента.", privilege = "Manage Events", adminOnly = true, OnRun = function(self, client) PLUGIN:SetZonePoint2(client) end }) ix.command.Add("EventClearZone", { description = "Очистить зону ивента.", privilege = "Manage Events", adminOnly = true, OnRun = function(self, client) PLUGIN:ClearZone(client) end }) ix.command.Add("EventZoneStart", { description = "Начать сужение зоны ивента.", privilege = "Manage Events", adminOnly = true, OnRun = function(self, client) PLUGIN:StartZoneShrinking(client) end }) ix.command.Add("EventZoneStop", { description = "Остановить сужение зоны ивента.", privilege = "Manage Events", adminOnly = true, OnRun = function(self, client) PLUGIN:StopZoneShrinking(client) end }) -- Temporary Spawns Commands ix.command.Add("EventSpawnAdd", { description = "Добавить временный спавн для фракции или spec_def.", privilege = "Manage Events", adminOnly = true, arguments = { ix.type.string, -- Faction Name bit.bor(ix.type.number, ix.type.optional) -- spec_def }, OnRun = function(self, client, factionName, specDef) local faction = ix.faction.teams[factionName] if (!faction) then -- Try fuzzy match for _, v in pairs(ix.faction.indices) do if (ix.util.StringMatches(v.name, factionName) or ix.util.StringMatches(v.uniqueID, factionName)) then faction = v break end end end if (!faction) then return "Некорректное название фракции!" end PLUGIN:AddTempSpawn(faction.uniqueID, specDef, client:GetPos(), client:GetAngles()) local msg = "Временный спавн добавлен для фракции: " .. faction.name if (specDef) then msg = msg .. " (spec_def: " .. specDef .. ")" end return msg end }) ix.command.Add("EventSpawnRemove", { description = "Удалить временные спавны ивента в радиусе.", privilege = "Manage Events", adminOnly = true, arguments = { bit.bor(ix.type.number, ix.type.optional) -- Radius }, OnRun = function(self, client, radius) radius = radius or 120 local count = PLUGIN:RemoveTempSpawns(client:GetPos(), radius) return "Удалено " .. count .. " временных спавнов." end }) -- Doomsday Commands ix.command.Add("DoomsdayStart", { description = "Запустить ивент Судная Ночь.", privilege = "Manage Events", adminOnly = true, OnRun = function(self, client) if (DoomsdayNight.active) then return "Судная Ночь уже активна!" end DoomsdayNight:StartEvent(client) end }) ix.command.Add("DoomsdayStop", { description = "Остановить ивент Судная Ночь.", privilege = "Manage Events", adminOnly = true, OnRun = function(self, client) if (!DoomsdayNight.active) then return "Судная Ночь не активна!" end DoomsdayNight:EndEvent(client, true) end })