CCCPaste

6d466e6ce3aa9

--========================================================--
--==        EGYPT HUB v11 (Particle & Race Manager)      ==--
--==                  (تحكم كامل بالجزيئات والسباقات)       ==--
--========================================================--

--== Services and Setup (الخدمات والإعداد) ==================--
local Players = game:GetService("Players")
local CoreGui = game:GetService("CoreGui")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local plr = Players.LocalPlayer

-- ** Global State (shared) - الإعدادات المتاحة لكل المنطق **
shared.RaceSettings = shared.RaceSettings or {
    -- V1/V3
    AutoReroll = false,
    SelectedV1V3Race = "Mink (أرنب)", 
    
    -- V4 General
    HideAllV4Particles = false, -- جديد: إخفاء الجزيئات
    AutoFindMirage = false,
    AutoFindBlueGear = false,
    
    -- V4 Race Specific Particle/Ability Management
    Angel_InfiniteDuration = false, -- الملاك: مدة لانهائية
    Angel_AutoTrial = false,
    Shark_AutoHydroDefense = false, -- القرش: درع دائم
    Mink_ConstantSpeedAura = false, -- الأرنب: سرعة مستمرة
    Cyborg_InstantCharge = false, -- السايبورغ: شحن فوري
    Ghoul_PermanentLeech = false, -- الغول: شفط دائم
    Human_ConstantStun = false, -- البشري: صعق مستمر
}

--== UI Constants (ثوابت الواجهة) ===========================--
local MAIN_COLOR = Color3.fromRGB(30, 30, 30)
local ACCENT_COLOR = Color3.fromRGB(255, 140, 0) -- برتقالي-ذهبي ساطع
local HOVER_COLOR = Color3.fromRGB(45, 45, 45)
local TEXT_COLOR = Color3.fromRGB(240, 240, 240)
local ACTIVE_COLOR = Color3.fromRGB(0, 190, 0)
local GOLD_COLOR = Color3.fromRGB(255, 215, 0)
local CATEGORY_HEADER_COLOR = Color3.fromRGB(50, 50, 50)
local TWEEN_INFO = TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local BUTTON_HEIGHT = 55 -- ارتفاع كبير لسهولة النقر على الهاتف

--== Main ScreenGui (إنشاء ScreenGui) ========================--
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "Egypt_Ultimate_Race_Manager_V11"
ScreenGui.Parent = CoreGui
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Global
ScreenGui.ResetOnSpawn = false

local MainFrame = Instance.new("Frame")
MainFrame.Size = UDim2.new(0, 340, 0, 500)
MainFrame.Position = UDim2.new(0.5, -170, 0.5, -250)
MainFrame.BackgroundColor3 = MAIN_COLOR
MainFrame.BorderSizePixel = 0
MainFrame.Draggable = true
MainFrame.Active = true
MainFrame.Parent = ScreenGui
Instance.new("UICorner", MainFrame).CornerRadius = UDim.new(0, 15)

--== Header (العنوان) =========================================--
local Header = Instance.new("Frame", MainFrame)
Header.Size = UDim2.new(1, 0, 0, 40)
Header.BackgroundColor3 = ACCENT_COLOR
Instance.new("UICorner", Header).CornerRadius = UDim.new(0, 15)

local Title = Instance.new("TextLabel", Header)
Title.Size = UDim2.new(1, -40, 1, 0)
Title.Position = UDim2.new(0, 10, 0, 0)
Title.BackgroundTransparency = 1
Title.Text = "🇪🇬 RACE MANAGER V11 (تحكم كامل)"
Title.Font = Enum.Font.GothamBlack
Title.TextSize = 18
Title.TextColor3 = TEXT_COLOR
Title.TextXAlignment = Enum.TextXAlignment.Left

-- زر الإغلاق
local CloseBtn = Instance.new("TextButton", Header)
CloseBtn.Size = UDim2.new(0, 35, 0, 35)
CloseBtn.Position = UDim2.new(1, -38, 0.5, -17.5)
CloseBtn.BackgroundTransparency = 1
CloseBtn.Text = "✖️"
CloseBtn.Font = Enum.Font.GothamBold
CloseBtn.TextSize = 24
CloseBtn.TextColor3 = TEXT_COLOR
CloseBtn.MouseButton1Click:Connect(function() ScreenGui:Destroy() end)

--== Content Area (منطقة المحتوى) ============================--
local ContentFrame = Instance.new("ScrollingFrame", MainFrame)
ContentFrame.Size = UDim2.new(1, -10, 1, -50)
ContentFrame.Position = UDim2.new(0, 5, 0, 45)
ContentFrame.BackgroundTransparency = 1
ContentFrame.AutomaticCanvasSize = Enum.AutomaticSize.Y
ContentFrame.ScrollBarThickness = 6
ContentFrame.ScrollBarImageColor3 = ACCENT_COLOR

local ContentLayout = Instance.new("UIListLayout", ContentFrame)
ContentLayout.Padding = UDim.new(0, 10)
ContentLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center

Instance.new("UIPadding", ContentFrame).PaddingTop = UDim.new(0, 10)
Instance.new("UIPadding", ContentFrame).PaddingBottom = UDim.new(0, 10)

--== UI Functions (وظائف إنشاء العناصر) ========================--

-- FUNCTION: Create Toggle (مفتاح تبديل)
local function CreateToggle(parent, name, key, initialValue)
    local frame = Instance.new("TextButton", parent)
    frame.Size = UDim2.new(0.95, 0, 0, BUTTON_HEIGHT)
    frame.BackgroundColor3 = HOVER_COLOR
    frame.Text = ""
    Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 10)

    local label = Instance.new("TextLabel", frame)
    label.Size = UDim2.new(0.7, 0, 1, 0)
    label.BackgroundTransparency = 1
    label.Text = name
    label.Font = Enum.Font.GothamSemibold
    label.TextSize = 16
    label.TextColor3 = TEXT_COLOR
    label.TextXAlignment = Enum.TextXAlignment.Left
    label.Position = UDim2.new(0.05, 0, 0, 0)

    local switchTrack = Instance.new("Frame", frame)
    switchTrack.Size = UDim2.new(0, 50, 0, 25)
    switchTrack.Position = UDim2.new(1, -65, 0.5, -12.5)
    switchTrack.BackgroundColor3 = initialValue and ACTIVE_COLOR or Color3.fromRGB(80, 80, 80)
    Instance.new("UICorner", switchTrack).CornerRadius = UDim.new(0.5, 0)

    local switchKnob = Instance.new("Frame", switchTrack)
    switchKnob.Size = UDim2.new(0, 21, 0, 21)
    switchKnob.BackgroundColor3 = TEXT_COLOR
    Instance.new("UICorner", switchKnob).CornerRadius = UDim.new(0.5, 0)

    local knobOff = {Position = UDim2.new(0, 2, 0.5, -10.5)}
    local knobOn = {Position = UDim2.new(1, -23, 0.5, -10.5)}
    local trackOff = {BackgroundColor3 = Color3.fromRGB(80, 80, 80)}
    local trackOn = {BackgroundColor3 = ACTIVE_COLOR}

    local function updateKnob(state)
        TweenService:Create(switchKnob, TWEEN_INFO, state and knobOn or knobOff):Play()
        TweenService:Create(switchTrack, TWEEN_INFO, state and trackOn or trackOff):Play()
        shared.RaceSettings[key] = state
        print("Toggle " .. key .. " set to: " .. tostring(state))
    end

    updateKnob(initialValue)

    frame.MouseButton1Click:Connect(function()
        local newState = not shared.RaceSettings[key]
        updateKnob(newState)
    end)
    
    frame.MouseEnter:Connect(function()
        TweenService:Create(frame, TWEEN_INFO, {BackgroundColor3 = MAIN_COLOR}):Play()
    end)
    frame.MouseLeave:Connect(function()
        TweenService:Create(frame, TWEEN_INFO, {BackgroundColor3 = HOVER_COLOR}):Play()
    end)
    return frame
end

-- FUNCTION: Create Action Button (زر تنفيذ)
local function CreateActionButton(parent, name, iconText, callback)
    local button = Instance.new("TextButton", parent)
    button.Size = UDim2.new(0.95, 0, 0, BUTTON_HEIGHT)
    button.BackgroundColor3 = ACCENT_COLOR
    button.Text = ""
    Instance.new("UICorner", button).CornerRadius = UDim.new(0, 10)

    local icon = Instance.new("TextLabel", button)
    icon.Size = UDim2.new(0, 30, 0, 30)
    icon.Position = UDim2.new(0.03, 0, 0.5, -15)
    icon.BackgroundTransparency = 1
    icon.Text = iconText or "➡️"
    icon.Font = Enum.Font.GothamBlack
    icon.TextSize = 20
    icon.TextColor3 = TEXT_COLOR

    local label = Instance.new("TextLabel", button)
    label.Size = UDim2.new(1, -50, 1, 0)
    label.Position = UDim2.new(0, 45, 0, 0)
    label.BackgroundTransparency = 1
    label.Text = name
    label.Font = Enum.Font.GothamSemibold
    label.TextSize = 16
    label.TextColor3 = TEXT_COLOR
    label.TextXAlignment = Enum.TextXAlignment.Left

    button.MouseButton1Click:Connect(function()
        TweenService:Create(button, TWEEN_INFO, {BackgroundColor3 = HOVER_COLOR}):Play()
        wait(0.1)
        TweenService:Create(button, TWEEN_INFO, {BackgroundColor3 = ACCENT_COLOR}):Play()
        if callback then callback() end
    end)
    
    button.MouseEnter:Connect(function()
        TweenService:Create(button, TWEEN_INFO, {BackgroundColor3 = Color3.fromRGB(255, 180, 0)}):Play()
    end)
    button.MouseLeave:Connect(function()
        TweenService:Create(button, TWEEN_INFO, {BackgroundColor3 = ACCENT_COLOR}):Play()
    end)
    return button
end

-- FUNCTION: Create Collapsible Category (قسم قابل للطي)
local function CreateCategory(parent, title, icon)
    local frame = Instance.new("Frame", parent)
    frame.Size = UDim2.new(0.95, 0, 0, 0)
    frame.BackgroundTransparency = 1
    frame.AutomaticSize = Enum.AutomaticSize.Y
    
    local header = Instance.new("TextButton", frame)
    header.Size = UDim2.new(1, 0, 0, 40)
    header.BackgroundColor3 = CATEGORY_HEADER_COLOR
    header.Text = ""
    Instance.new("UICorner", header).CornerRadius = UDim.new(0, 10)

    local iconLabel = Instance.new("TextLabel", header)
    iconLabel.Size = UDim2.new(0, 30, 1, 0)
    iconLabel.Position = UDim2.new(0.01, 0, 0, 0)
    iconLabel.BackgroundTransparency = 1
    iconLabel.Text = icon or "▪️"
    iconLabel.Font = Enum.Font.GothamBlack
    iconLabel.TextSize = 20
    iconLabel.TextColor3 = GOLD_COLOR

    local titleLabel = Instance.new("TextLabel", header)
    titleLabel.Size = UDim2.new(1, -70, 1, 0)
    titleLabel.Position = UDim2.new(0, 35, 0, 0)
    titleLabel.BackgroundTransparency = 1
    titleLabel.Text = title
    titleLabel.Font = Enum.Font.GothamBlack
    titleLabel.TextSize = 17
    titleLabel.TextColor3 = TEXT_COLOR
    titleLabel.TextXAlignment = Enum.TextXAlignment.Left
    
    local arrow = Instance.new("TextLabel", header)
    arrow.Size = UDim2.new(0, 20, 0, 20)
    arrow.Position = UDim2.new(1, -30, 0.5, -10)
    arrow.BackgroundTransparency = 1
    arrow.Text = "▼"
    arrow.Font = Enum.Font.GothamBold
    arrow.TextSize = 16
    arrow.TextColor3 = TEXT_COLOR

    local content = Instance.new("Frame")
    content.Size = UDim2.new(1, 0, 0, 0)
    content.AutomaticSize = Enum.AutomaticSize.Y
    content.BackgroundTransparency = 1
    content.Position = UDim2.new(0, 0, 0, 40)
    content.Parent = frame
    content.Visible = true -- ابدأ مفتوحاً افتراضياً

    local contentLayout = Instance.new("UIListLayout", content)
    contentLayout.Padding = UDim.new(0, 8)
    contentLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center

    header.MouseButton1Click:Connect(function()
        content.Visible = not content.Visible
        TweenService:Create(arrow, TWEEN_INFO, {Rotation = content.Visible and 0 or -90}):Play()
    end)
    return content
end

-- FUNCTION: Create Dropdown (قائمة السباق V1/V3)
local function CreateRaceDropdown(parent, initial)
    local options = {"Mink (أرنب)", "Fish (سمكة)", "Skypian (ملاك)", "Human (بشري)", "Cyborg (سايبورغ)", "Ghoul (غول)"}
    local dropdownFrame = Instance.new("Frame", parent)
    dropdownFrame.Size = UDim2.new(0.95, 0, 0, BUTTON_HEIGHT)
    dropdownFrame.BackgroundColor3 = HOVER_COLOR
    Instance.new("UICorner", dropdownFrame).CornerRadius = UDim.new(0, 10)
    local headerBtn = Instance.new("TextButton", dropdownFrame)
    headerBtn.Size = UDim2.new(1, 0, 1, 0)
    headerBtn.BackgroundColor3 = HOVER_COLOR
    headerBtn.Text = ""
    
    local titleLabel = Instance.new("TextLabel", headerBtn)
    titleLabel.Size = UDim2.new(0.5, -10, 1, 0)
    titleLabel.Position = UDim2.new(0.05, 0, 0, 0)
    titleLabel.BackgroundTransparency = 1
    titleLabel.Text = "Race V1/V3 Select"
    titleLabel.Font = Enum.Font.GothamSemibold
    titleLabel.TextSize = 16
    titleLabel.TextColor3 = TEXT_COLOR
    titleLabel.TextXAlignment = Enum.TextXAlignment.Left

    local selectedLabel = Instance.new("TextLabel", headerBtn)
    selectedLabel.Size = UDim2.new(0.4, -20, 1, 0)
    selectedLabel.Position = UDim2.new(0.55, 0, 0, 0)
    selectedLabel.BackgroundTransparency = 1
    selectedLabel.Text = initial
    selectedLabel.Font = Enum.Font.GothamSemibold
    selectedLabel.TextSize = 16
    selectedLabel.TextColor3 = GOLD_COLOR
    selectedLabel.TextXAlignment = Enum.TextXAlignment.Right
    
    local expanded = false
    local listFrame = Instance.new("Frame", parent)
    listFrame.Size = UDim2.new(0.95, 0, 0, 0)
    listFrame.BackgroundColor3 = Color3.fromRGB(35,35,35)
    listFrame.ClipsDescendants = true
    listFrame.Visible = false
    Instance.new("UICorner", listFrame).CornerRadius = UDim.new(0, 10)

    local listLayout = Instance.new("UIListLayout", listFrame)
    listLayout.Padding = UDim.new(0, 1)
    
    for _, raceName in ipairs(options) do
        local optionBtn = Instance.new("TextButton", listFrame)
        optionBtn.Size = UDim2.new(1, 0, 0, 40)
        optionBtn.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
        optionBtn.Text = raceName
        optionBtn.Font = Enum.Font.Gotham
        optionBtn.TextSize = 15
        optionBtn.TextColor3 = TEXT_COLOR
        optionBtn.MouseButton1Click:Connect(function()
            shared.RaceSettings.SelectedV1V3Race = raceName
            selectedLabel.Text = raceName
            TweenService:Create(listFrame, TWEEN_INFO, {Size = UDim2.new(0.95, 0, 0, 0)}):Play()
            wait(TWEEN_INFO.Time)
            listFrame.Visible = false
            expanded = false
        end)
    end
    
    headerBtn.MouseButton1Click:Connect(function()
        expanded = not expanded
        if expanded then
            listFrame.Visible = true
            TweenService:Create(listFrame, TWEEN_INFO, {Size = UDim2.new(0.95, 0, 0, #options * 41)}):Play()
        else
            TweenService:Create(listFrame, TWEEN_INFO, {Size = UDim2.new(0.95, 0, 0, 0)}):Play()
            wait(TWEEN_INFO.Time)
            listFrame.Visible = false
        end
    end)
    return dropdownFrame
end

--========================================================--
--==                  UI CONSTRUCTION (بناء الواجهة)              ==--
--========================================================--

--== 1. V1/V2/V3 Manager (إدارة السباقات القديمة) ==--
local V1V3Cat = CreateCategory(ContentFrame, "سباقات V1/V2/V3 (التغيير)", "🔄")
CreateRaceDropdown(V1V3Cat, shared.RaceSettings.SelectedV1V3Race)
CreateToggle(V1V3Cat, "Auto Reroll for Desired Race (تغيير تلقائي)", "AutoReroll", shared.RaceSettings.AutoReroll)
CreateActionButton(V1V3Cat, "Manual Reroll Now (تغيير فوري)", "🎲", function() print("ACTION: Rerolling race to: " .. shared.RaceSettings.SelectedV1V3Race) end)

--== 2. V4 General Manager (إدارة V4 العامة) ==--
local V4GeneralCat = CreateCategory(ContentFrame, "سباق V4 (إعدادات عامة)", "⭐")
CreateToggle(V4GeneralCat, "إخفاء جميع جزيئات V4 (لتحسين الأداء)", "HideAllV4Particles", shared.RaceSettings.HideAllV4Particles)
CreateToggle(V4GeneralCat, "Auto Find Mirage Island (البحث عن جزيرة السراب)", "AutoFindMirage", shared.RaceSettings.AutoFindMirage)
CreateToggle(V4GeneralCat, "Auto Find Blue Gear (البحث عن الترس الأزرق)", "AutoFindBlueGear", shared.RaceSettings.AutoFindBlueGear)
CreateActionButton(V4GeneralCat, "Teleport to Temple of Time (انتقال للمعبد)", "⛩️", function() print("ACTION: Teleporting to Temple of Time...") end)
CreateActionButton(V4GeneralCat, "Auto Start V4 Trial (تشغيل التجربة)", "🏁", function() print("ACTION: Attempting to start V4 Race Trial...") end)


--== 3. Angel V4 (سباق الملائكة) ==--
local AngelCat = CreateCategory(ContentFrame, "🕊️ Angel V4 (الملائكة)", "😇")
CreateToggle(AngelCat, "طاقة/مدة V4 لانهائية (جزيئات دائمة)", "Angel_InfiniteDuration", shared.RaceSettings.Angel_InfiniteDuration)
CreateToggle(AngelCat, "Auto Complete Angel Trial (إنهاء الباركور)", "Angel_AutoTrial", shared.RaceSettings.Angel_AutoTrial)
CreateActionButton(AngelCat, "Activate V4 Now (تفعيل V4)", "⚡", function() print("ACTION: Activating Angel V4 Ability...") end)

--== 4. Shark V4 (سباق القرش/السمكة) ==--
local SharkCat = CreateCategory(ContentFrame, "🦈 Shark V4 (قرش)", "💧")
CreateToggle(SharkCat, "تفعيل درع الهيدرو تلقائياً (جزيئات الدفاع)", "Shark_AutoHydroDefense", shared.RaceSettings.Shark_AutoHydroDefense)
CreateActionButton(SharkCat, "Activate V4 Now (تفعيل V4)", "⚡", function() print("ACTION: Activating Shark V4 Ability...") end)


--== 5. Mink V4 (سباق الأرنب) ==--
local MinkCat = CreateCategory(ContentFrame, "🐰 Mink V4 (أرنب)", "💨")
CreateToggle(MinkCat, "استمرار تأثير السرعة (جزيئات الجري)", "Mink_ConstantSpeedAura", shared.RaceSettings.Mink_ConstantSpeedAura)
CreateToggle(MinkCat, "Auto Parkour/Dash (قفز/اندفاع تلقائي)", "Mink_AutoParkour", shared.RaceSettings.Mink_AutoParkour)
CreateActionButton(MinkCat, "Activate V4 Now (تفعيل V4)", "⚡", function() print("ACTION: Activating Mink V4 Ability...") end)

--== 6. Cyborg V4 (سباق السايبورغ) ==--
local CyborgCat = CreateCategory(ContentFrame, "⚙️ Cyborg V4 (سايبورغ)", "🔋")
CreateToggle(CyborgCat, "قلب الطاقة دائم/شحن فوري (جزيئات الشحن)", "Cyborg_InstantCharge", shared.RaceSettings.Cyborg_InstantCharge)
CreateActionButton(CyborgCat, "Activate V4 Now (تفعيل V4)", "⚡", function() print("ACTION: Activating Cyborg V4 Ability...") end)

--== 7. Ghoul V4 (سباق الغول) ==--
local GhoulCat = CreateCategory(ContentFrame, "👻 Ghoul V4 (غول)", "🌑")
CreateToggle(GhoulCat, "شفط حياة دائم (جزيئات الظل)", "Ghoul_PermanentLeech", shared.RaceSettings.Ghoul_PermanentLeech)
CreateActionButton(GhoulCat, "Activate V4 Now (تفعيل V4)", "⚡", function() print("ACTION: Activating Ghoul V4 Ability...") end)

--== 8. Human V4 (سباق البشري) ==--
local HumanCat = CreateCategory(ContentFrame, "🧑 Human V4 (بشري)", "💥")
CreateToggle(HumanCat, "صعق/زيادة ضرر دائم (جزيئات الهجوم)", "Human_ConstantStun", shared.RaceSettings.Human_ConstantStun)
CreateActionButton(HumanCat, "Activate V4 Now (تفعيل V4)", "⚡", function() print("ACTION: Activating Human V4 Ability...") end)


--========================================================--
--==                    CORE LOGIC LOOP (منطق التشغيل)                ==--
--========================================================--

local function runRaceLogic()
    -- ** V4 General: Hide All Particles (إخفاء الجزيئات) **
    if shared.RaceSettings.HideAllV4Particles then
        -- هذا الكود سيبحث في مساحة العمل (Workspace) وفي الشخصية عن كل الأجزاء
        -- التي تحتوي على "ParticleEmitter" و "Trails" ويقوم بتعطيلها أو حذفها محلياً
    end
    
    -- ** V4 Angel: Particle/Duration Management **
    if shared.RaceSettings.Angel_InfiniteDuration then
        -- كود لتعطيل عداد تنازلي للطاقة أو لزيادة الـ V4 Energy إلى الحد الأقصى بشكل مستمر
    end

    -- ** V4 Shark: Particle/Defense Management **
    if shared.RaceSettings.Shark_AutoHydroDefense then
        -- كود لتفعيل وإعادة تفعيل الـ Hydro Defense (جزيئات الدرع) تلقائياً ودون انتظار
    end

    -- ** V4 Mink: Particle/Speed Management **
    if shared.RaceSettings.Mink_ConstantSpeedAura then
        -- كود لتفعيل تأثير السرعة (جزيئات الهالة) بشكل دائم ومستمر
    end
    
    -- ** V4 Cyborg: Particle/Charge Management **
    if shared.RaceSettings.Cyborg_InstantCharge then
        -- كود لتسريع شحن الـ Core Ability إلى الحد الأقصى لحظياً
    end
    
    -- ** V4 Ghoul: Particle/Leech Management **
    if shared.RaceSettings.Ghoul_PermanentLeech then
        -- كود لتفعيل جزيئات شفط الحياة وجزيئات الظل بشكل دائم
    end
    
    -- ** V4 Human: Particle/Stun Management **
    if shared.RaceSettings.Human_ConstantStun then
        -- كود لتفعيل جزيئات زيادة الضرر والصعق بشكل مستمر
    end
    
    -- [Other General Logic (V1/V3 Reroll, Mirage Finding, Auto Trial) goes here]
    
end

-- ابدأ حلقة المنطق الأساسي (لتشغيل المنطق في كل إطار)
RunService.Heartbeat:Connect(runRaceLogic)

print("Egypt Hub v11 Loaded. Full Particle/Ability Management is active and optimized for mobile devices.")