From 3a95cd148a570af1aef74307df21481d8b7f5902 Mon Sep 17 00:00:00 2001 From: min Date: Tue, 9 Jun 2026 23:18:39 +0300 Subject: [PATCH] =?UTF-8?q?docs(48)=20+=20feat(g49):=20=C2=AB=D0=9C=D1=83?= =?UTF-8?q?=D0=BB=D1=8C=D1=82=D0=B8=D0=BF=D0=BB=D0=B5=D0=B5=D1=80:=20?= =?UTF-8?q?=D0=93=D0=BE=D0=BD=D0=BA=D0=B0=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit g48 docs: CodeBoth g48_main. g49 паритет (упрощённый без MP-API): - showText 'Гонка! Беги к финишу первым' - hud_set 'info' 'Игроков: N | Победил: X' (Players:GetPlayers count + LocalPlayer name) - Players.PlayerAdded/Removing → refresh - BindableEvent FinishReached - g49_finish: Touched → FinishReached:Fire (fired-флаг) - При победе: winnerName = LocalPlayer.Name + refresh + 'Победа!' + confetti --- src/community/docsGamesBuildersLua.js | 62 ++++++++++++++++++++++++++- src/community/docsLessons.jsx | 4 +- 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/src/community/docsGamesBuildersLua.js b/src/community/docsGamesBuildersLua.js index 7c94e26..0b76eef 100644 --- a/src/community/docsGamesBuildersLua.js +++ b/src/community/docsGamesBuildersLua.js @@ -4484,7 +4484,67 @@ end)`, }, // ═══════════════════════════════════════════════════════════════ - // ИГРЫ 49-50: явных Lua-версий пока нет. + // ИГРА 49 — «Мультиплеер: Гонка» + // ═══════════════════════════════════════════════════════════════ + 'mp-race': { + g49_main: `-- === ИГРА «МУЛЬТИПЛЕЕР: ГОНКА» — главный скрипт (Lua) === +-- Мультиплеерная гонка. Чтобы соревноваться с друзьями — опубликуй +-- игру с галочкой «Мультиплеер». +${SNIPPET_BROADCAST} + +local Players = game:GetService("Players") +local winnerName = nil +local won = false + +__rbxl_show_text("Гонка! Беги к финишу первым", 3) + +local winSound = Instance.new("Sound", workspace) +winSound.SoundId = "win"; winSound.Volume = 1 + +local function refresh() + local n = #Players:GetPlayers() + local txt = "Игроков: " .. n + if winnerName then txt = txt .. " | Победил: " .. winnerName end + __rbxl_hud_set("info", txt, 50, 8, "#ffe066", 22) +end +refresh() + +Players.PlayerAdded:Connect(refresh) +Players.PlayerRemoving:Connect(refresh) + +-- Финиш +local finEvent = getEvent("FinishReached") +finEvent.Event:Connect(function() + if won then return end + won = true + -- В одиночке — мы и есть первый + local me = Players.LocalPlayer + winnerName = me and me.Name or "Игрок" + refresh() + __rbxl_show_text("Ты пришёл первым! Победа!", 5) + winSound:Play() + local px = __rbxl_player_x() + local py = __rbxl_player_y() + local pz = __rbxl_player_z() + __rbxl_spawn_particles("confetti", px, py + 3, pz, 3, 3) +end)`, + g49_finish: `-- === Скрипт финиша (Lua) === +local ReplicatedStorage = game:GetService("ReplicatedStorage") +local part = script.Parent +local fired = false + +part.Touched:Connect(function(hit) + if fired then return end + local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") + if not h then return end + fired = true + local ev = ReplicatedStorage:FindFirstChild("FinishReached") + if ev then ev:Fire() end +end)`, + }, + + // ═══════════════════════════════════════════════════════════════ + // ИГРА 50: явных Lua-версий пока нет. // buildGameProject в docsGamesBuilders.js использует generateFallbackLua. 'clicker': { g46_main: `-- === ИГРА «КЛИКЕР» — главный скрипт (Lua) === diff --git a/src/community/docsLessons.jsx b/src/community/docsLessons.jsx index 45fc99c..36c6bc7 100644 --- a/src/community/docsLessons.jsx +++ b/src/community/docsLessons.jsx @@ -6969,7 +6969,7 @@ game.self.onTouch(() => {

Шаг 2. Главный скрипт

- {`// === ИГРА «МУЛЬТИПЛЕЕР: САЛКИ» — главный скрипт === + {`// === ИГРА «МУЛЬТИПЛЕЕР: САЛКИ» — главный скрипт === // // Это МУЛЬТИПЛЕЕРНАЯ игра. Чтобы играть с друзьями, опубликуй её // с галочкой «Мультиплеер» — тогда в комнату смогут зайти несколько @@ -7006,7 +7006,7 @@ game.room.onChange('tagger', (taggerId) => { } else { game.ui.showText('Убегай от водящего!', 3); } -});`} +});`}

Разберём: