diff --git a/Hunter.rbxl b/Hunter.rbxl index 850f3f0..feb9f38 100644 Binary files a/Hunter.rbxl and b/Hunter.rbxl differ diff --git a/scripts/ArenaObjectives.luau b/scripts/ArenaObjectives.luau index aba0959..7d8551d 100644 --- a/scripts/ArenaObjectives.luau +++ b/scripts/ArenaObjectives.luau @@ -214,7 +214,8 @@ function Objectives.start(config: Config): Match local c = p.Character local h = c and c:FindFirstChildOfClass("Humanoid") local r = c and c:FindFirstChild("HumanoidRootPart") - if side and h and h.Health > 0 and r and r:IsA("BasePart") and p:GetAttribute("InArena") == true then + if side and h and h.Health > 0 and r and r:IsA("BasePart") and p:GetAttribute("InArena") == true + and p:GetAttribute("ArenaWaiting") ~= true then table.insert(found, {player = p, side = side, root = r}) end end @@ -556,7 +557,7 @@ function Objectives.start(config: Config): Match for _, p in members do config.bench(p) end lifeActive, nextMini = false, now + 4 end - if now >= nextMini then config.balanceWaiting() end + if now >= nextMini then config.balanceWaiting() end local ready: {Player} = {} local b, o = false, false for _, p in members do @@ -572,7 +573,7 @@ function Objectives.start(config: Config): Match lifeActive, lifeEnds = true, now + 45 status("Мини-раунд " .. miniNumber) elseif not b or not o then - status("Ожидаем игроков с обеих сторон") + status("Ждём игроков в обеих командах") else status("Следующий мини-раунд через " .. math.ceil(nextMini - now) .. " с") end diff --git a/scripts/ArenaRounds.server.luau b/scripts/ArenaRounds.server.luau index d12dc49..1c52996 100644 --- a/scripts/ArenaRounds.server.luau +++ b/scripts/ArenaRounds.server.luau @@ -158,10 +158,14 @@ local function clearTools(container: Instance?) end local function guardInventory(player: Player, container: Instance) + local function disarmed(): boolean + return player:GetAttribute("InArena") ~= true or player:GetAttribute("ArenaWaiting") == true + or player:GetAttribute("ArenaIntermission") == true + end container.ChildAdded:Connect(function(child) - if player:GetAttribute("InArena") ~= true and child:IsA("Tool") then child:Destroy() end + if child:IsA("Tool") and disarmed() then child:Destroy() end end) - if player:GetAttribute("InArena") ~= true then clearTools(container) end + if disarmed() then clearTools(container) end end local function resetStreak(player: Player) @@ -190,12 +194,6 @@ local function moveToLobby(player: Player) end end -local function bench(player: Player) - if not roster[player] then return end - player:SetAttribute("ArenaWaiting", true) - moveToLobby(player) -end - local function sendToLobby(player: Player) roster[player] = nil joinOrder[player] = nil @@ -243,12 +241,24 @@ end local function stageOnArena(player: Player) placedCharacter[player] = nil player:SetAttribute("InArena", true) - player.RespawnLocation = destinationFor(player) + local destination = destinationFor(player) + player.RespawnLocation = destination local character = player.Character clearTools(character) clearTools(player:FindFirstChildOfClass("Backpack")) clearTools(player:FindFirstChild("StarterGear")) - return character + return character, destination +end + +local function bench(player: Player) + if not roster[player] then return end + player:SetAttribute("ArenaWaiting", true) + local character, destination = stageOnArena(player) + local humanoid = character and character:FindFirstChildOfClass("Humanoid") + if character and humanoid and humanoid.Health > 0 then + humanoid.Health = humanoid.MaxHealth + ArenaSpawns.place(character, destination) + end end local function enterRound(player: Player, match: Match) @@ -283,7 +293,9 @@ local function onCharacter(player: Player, character: Model) end) if roster[player] and player:GetAttribute("InArena") == true then if player:GetAttribute("ArenaIntermission") == true or player:GetAttribute("ArenaWaiting") == true then - ArenaSpawns.place(character, destinationFor(player)) + local destination = player.RespawnLocation or destinationFor(player) + player.RespawnLocation = destination + ArenaSpawns.place(character, destination) else enterArena(player, character, humanoid) end @@ -554,18 +566,8 @@ local function returnVoters(match: Match) balanceWaiting(match) for _, player in returning do - if match.rule == "OneLife" then - player:SetAttribute("ArenaWaiting", true) - local character = stageOnArena(player) - local humanoid = character and character:FindFirstChildOfClass("Humanoid") - if character and humanoid and humanoid.Health > 0 then - humanoid.Health = humanoid.MaxHealth - ArenaSpawns.place(character, destinationFor(player)) - end - else - deploy(player) - end player:SetAttribute("ArenaIntermission", nil) + enterRound(player, match) end end