1144 lines
40 KiB
Lua
1144 lines
40 KiB
Lua
-- Ultimate GaG Auto Farm - Compact & Collapsible
|
||
-- รวมทุกฟีเจอร์ไว้ที่เดียว ปรับได้หมด UI เล็กกะทัดรัด
|
||
|
||
print("🌱 Loading Ultimate GaG Auto Farm...")
|
||
|
||
-- Services
|
||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||
local Players = game:GetService("Players")
|
||
local RunService = game:GetService("RunService")
|
||
local UserInputService = game:GetService("UserInputService")
|
||
local TweenService = game:GetService("TweenService")
|
||
|
||
local LocalPlayer = Players.LocalPlayer
|
||
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
|
||
local Leaderstats = LocalPlayer:WaitForChild("leaderstats")
|
||
local Backpack = LocalPlayer:WaitForChild("Backpack")
|
||
|
||
print("✅ Services loaded")
|
||
|
||
-- ป้องกันการรันซ้ำ
|
||
if _G.UltimateGaGFarmLoaded then
|
||
print("⚠️ Ultimate GaG Farm already loaded, removing old one...")
|
||
if _G.UltimateGaGFarmUI then
|
||
_G.UltimateGaGFarmUI:Destroy()
|
||
end
|
||
end
|
||
_G.UltimateGaGFarmLoaded = true
|
||
|
||
-- Game Objects
|
||
local GameEvents = ReplicatedStorage:WaitForChild("GameEvents")
|
||
local Farms = workspace:WaitForChild("Farm")
|
||
|
||
print("✅ Game objects found")
|
||
|
||
-- Ultimate Settings
|
||
local Settings = {
|
||
-- Auto Farm Settings
|
||
AutoPlant = false,
|
||
AutoHarvest = false,
|
||
AutoSell = false,
|
||
AutoBuy = false,
|
||
|
||
-- Plant Settings
|
||
SelectedSeed = "Carrot",
|
||
PlantRandom = false,
|
||
PlantDelay = 0.3,
|
||
|
||
-- Harvest Settings
|
||
HarvestAll = true,
|
||
HarvestSpeed = "Ultra Fast", -- "Normal", "Fast", "Ultra Fast", "Instant"
|
||
HarvestDelay = 0.1,
|
||
|
||
-- Sell Settings
|
||
SellThreshold = 15,
|
||
AutoSellDelay = 5,
|
||
|
||
-- Speed Settings
|
||
MainLoopSpeed = 0.5,
|
||
PlantLoopSpeed = 8,
|
||
HarvestLoopSpeed = 0.5,
|
||
|
||
-- Visual Settings
|
||
ShowNotifications = true,
|
||
ShowDebugInfo = false,
|
||
|
||
-- Advanced Settings
|
||
MaxPlantsPerCycle = 50,
|
||
MaxHarvestPerCycle = 100,
|
||
TeleportToSell = true,
|
||
SmartPlanting = true,
|
||
|
||
-- UI Settings
|
||
UICollapsed = false,
|
||
SectionsCollapsed = {
|
||
Plant = false,
|
||
Harvest = false,
|
||
Sell = false,
|
||
Advanced = true
|
||
}
|
||
}
|
||
|
||
-- Find Player's Farm
|
||
local function GetFarmOwner(Farm)
|
||
local Important = Farm:FindFirstChild("Important")
|
||
if not Important then return nil end
|
||
|
||
local Data = Important:FindFirstChild("Data")
|
||
if not Data then return nil end
|
||
|
||
local Owner = Data:FindFirstChild("Owner")
|
||
if not Owner then return nil end
|
||
|
||
return Owner.Value
|
||
end
|
||
|
||
local function GetFarm(PlayerName)
|
||
local AllFarms = Farms:GetChildren()
|
||
for _, Farm in pairs(AllFarms) do
|
||
local Owner = GetFarmOwner(Farm)
|
||
if Owner == PlayerName then
|
||
return Farm
|
||
end
|
||
end
|
||
return nil
|
||
end
|
||
|
||
local MyFarm = GetFarm(LocalPlayer.Name)
|
||
if not MyFarm then
|
||
warn("❌ Cannot find player's farm!")
|
||
game:GetService("StarterGui"):SetCore("SendNotification", {
|
||
Title = "Ultimate GaG Farm",
|
||
Text = "ไม่พบฟาร์มของคุณ!",
|
||
Duration = 5
|
||
})
|
||
return
|
||
end
|
||
|
||
print("✅ Found player farm: " .. MyFarm.Name)
|
||
|
||
local MyImportant = MyFarm:FindFirstChild("Important")
|
||
local PlantLocations = MyImportant:FindFirstChild("Plant_Locations")
|
||
local PlantsPhysical = MyImportant:FindFirstChild("Plants_Physical")
|
||
|
||
if not PlantLocations or not PlantsPhysical then
|
||
warn("❌ Farm components not found!")
|
||
return
|
||
end
|
||
|
||
-- Helper Functions
|
||
local function GetArea(Base)
|
||
local Center = Base:GetPivot()
|
||
local Size = Base.Size
|
||
|
||
local X1 = math.ceil(Center.X - (Size.X/2))
|
||
local Z1 = math.ceil(Center.Z - (Size.Z/2))
|
||
local X2 = math.floor(Center.X + (Size.X/2))
|
||
local Z2 = math.floor(Center.Z + (Size.Z/2))
|
||
|
||
return X1, Z1, X2, Z2
|
||
end
|
||
|
||
local Dirt = PlantLocations:FindFirstChildOfClass("Part")
|
||
local X1, Z1, X2, Z2 = GetArea(Dirt)
|
||
print("✅ Farm area: " .. X1 .. "," .. Z1 .. " to " .. X2 .. "," .. Z2)
|
||
|
||
-- Notification Function
|
||
local function Notify(title, text, duration)
|
||
if Settings.ShowNotifications then
|
||
game:GetService("StarterGui"):SetCore("SendNotification", {
|
||
Title = title or "Ultimate GaG Farm",
|
||
Text = text or "",
|
||
Duration = duration or 3
|
||
})
|
||
end
|
||
end
|
||
|
||
-- Debug Print
|
||
local function DebugPrint(text)
|
||
if Settings.ShowDebugInfo then
|
||
print("[DEBUG] " .. tostring(text))
|
||
end
|
||
end
|
||
|
||
-- Plant Function
|
||
local function Plant(Position, Seed)
|
||
local PlantEvent = GameEvents:FindFirstChild("Plant_RE")
|
||
if PlantEvent then
|
||
PlantEvent:FireServer(Position, Seed)
|
||
if Settings.PlantDelay > 0 then
|
||
wait(Settings.PlantDelay)
|
||
end
|
||
return true
|
||
end
|
||
return false
|
||
end
|
||
|
||
-- Get Owned Seeds
|
||
local function GetOwnedSeeds()
|
||
local Seeds = {}
|
||
local Character = LocalPlayer.Character
|
||
|
||
local function CollectFromParent(Parent)
|
||
for _, Tool in pairs(Parent:GetChildren()) do
|
||
if Tool:IsA("Tool") then
|
||
local PlantName = Tool:FindFirstChild("Plant_Name")
|
||
local Count = Tool:FindFirstChild("Numbers")
|
||
if PlantName and Count then
|
||
Seeds[PlantName.Value] = {
|
||
Count = Count.Value,
|
||
Tool = Tool
|
||
}
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
CollectFromParent(Backpack)
|
||
if Character then
|
||
CollectFromParent(Character)
|
||
end
|
||
|
||
return Seeds
|
||
end
|
||
|
||
-- Get Harvestable Plants with Speed Options
|
||
local function GetHarvestablePlants()
|
||
local Plants = {}
|
||
|
||
local function CollectHarvestable(Parent)
|
||
for _, Plant in pairs(Parent:GetChildren()) do
|
||
local Fruits = Plant:FindFirstChild("Fruits")
|
||
if Fruits then
|
||
CollectHarvestable(Fruits)
|
||
end
|
||
|
||
local Prompt = Plant:FindFirstChild("ProximityPrompt", true)
|
||
if Prompt and Prompt.Enabled then
|
||
table.insert(Plants, Plant)
|
||
end
|
||
end
|
||
end
|
||
|
||
-- เก็บจากฟาร์มของผู้เล่นก่อน
|
||
CollectHarvestable(PlantsPhysical)
|
||
|
||
-- เก็บจากฟาร์มคนอื่น (ถ้าเปิด HarvestAll)
|
||
if Settings.HarvestAll then
|
||
local AllFarms = Farms:GetChildren()
|
||
|
||
for _, Farm in pairs(AllFarms) do
|
||
if Farm ~= MyFarm then
|
||
if Settings.HarvestSpeed == "Instant" then
|
||
-- โหมด Instant ใช้ spawn
|
||
spawn(function()
|
||
local OtherPlantsPhysical = Farm:FindFirstChild("Important")
|
||
if OtherPlantsPhysical then
|
||
OtherPlantsPhysical = OtherPlantsPhysical:FindFirstChild("Plants_Physical")
|
||
if OtherPlantsPhysical then
|
||
CollectHarvestable(OtherPlantsPhysical)
|
||
end
|
||
end
|
||
end)
|
||
else
|
||
-- โหมดปกติ
|
||
local OtherPlantsPhysical = Farm:FindFirstChild("Important")
|
||
if OtherPlantsPhysical then
|
||
OtherPlantsPhysical = OtherPlantsPhysical:FindFirstChild("Plants_Physical")
|
||
if OtherPlantsPhysical then
|
||
CollectHarvestable(OtherPlantsPhysical)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
if Settings.HarvestSpeed == "Instant" then
|
||
wait(0.1) -- รอให้ spawn เสร็จ
|
||
end
|
||
end
|
||
|
||
return Plants
|
||
end
|
||
|
||
-- Harvest Plant Function
|
||
local function HarvestPlant(Plant)
|
||
local Prompt = Plant:FindFirstChild("ProximityPrompt", true)
|
||
if Prompt and Prompt.Enabled then
|
||
fireproximityprompt(Prompt)
|
||
|
||
-- ใส่ delay ตามการตั้งค่า
|
||
if Settings.HarvestDelay > 0 and Settings.HarvestSpeed ~= "Instant" then
|
||
wait(Settings.HarvestDelay)
|
||
end
|
||
|
||
return true
|
||
end
|
||
return false
|
||
end
|
||
|
||
-- Get Inventory Crops
|
||
local function GetInvCrops()
|
||
local Crops = {}
|
||
local Character = LocalPlayer.Character
|
||
|
||
local function CollectFromParent(Parent)
|
||
for _, Tool in pairs(Parent:GetChildren()) do
|
||
if Tool:IsA("Tool") then
|
||
local ItemString = Tool:FindFirstChild("Item_String")
|
||
if ItemString then
|
||
table.insert(Crops, Tool)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
CollectFromParent(Backpack)
|
||
if Character then
|
||
CollectFromParent(Character)
|
||
end
|
||
|
||
return Crops
|
||
end
|
||
|
||
-- Sell Inventory Function
|
||
local IsSelling = false
|
||
local function SellInventory()
|
||
if IsSelling then return end
|
||
IsSelling = true
|
||
|
||
local Character = LocalPlayer.Character
|
||
if not Character then
|
||
IsSelling = false
|
||
return
|
||
end
|
||
|
||
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
|
||
if not HumanoidRootPart then
|
||
IsSelling = false
|
||
return
|
||
end
|
||
|
||
local Previous = HumanoidRootPart.CFrame
|
||
local ShecklesCount = Leaderstats:FindFirstChild("Sheckles")
|
||
|
||
if Settings.TeleportToSell then
|
||
-- Teleport to sell area
|
||
HumanoidRootPart.CFrame = CFrame.new(62, 4, -26)
|
||
wait(0.5)
|
||
end
|
||
|
||
if ShecklesCount then
|
||
local PreviousSheckles = ShecklesCount.Value
|
||
|
||
local SellEvent = GameEvents:FindFirstChild("Sell_Inventory")
|
||
if SellEvent then
|
||
local attempts = 0
|
||
while attempts < 10 do
|
||
if ShecklesCount.Value ~= PreviousSheckles then break end
|
||
SellEvent:FireServer()
|
||
wait(0.2)
|
||
attempts = attempts + 1
|
||
end
|
||
|
||
local earned = ShecklesCount.Value - PreviousSheckles
|
||
if earned > 0 then
|
||
DebugPrint("💰 ขายได้เงิน " .. earned .. " sheckles")
|
||
if Settings.ShowNotifications then
|
||
Notify("💰 ขายสำเร็จ", "ได้เงิน " .. earned .. " sheckles", 2)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
if Settings.TeleportToSell then
|
||
-- Return to previous position
|
||
HumanoidRootPart.CFrame = Previous
|
||
end
|
||
|
||
wait(0.2)
|
||
IsSelling = false
|
||
end
|
||
|
||
-- Buy Seeds Function
|
||
local function BuySeed(Seed)
|
||
local BuyEvent = GameEvents:FindFirstChild("BuySeedStock")
|
||
if BuyEvent then
|
||
BuyEvent:FireServer(Seed)
|
||
return true
|
||
end
|
||
return false
|
||
end
|
||
|
||
-- Auto Plant Loop
|
||
local function AutoPlantLoop()
|
||
if not Settings.AutoPlant then return end
|
||
|
||
local OwnedSeeds = GetOwnedSeeds()
|
||
local SeedData = OwnedSeeds[Settings.SelectedSeed]
|
||
|
||
if not SeedData or SeedData.Count <= 0 then
|
||
if Settings.AutoBuy then
|
||
DebugPrint("🛒 ซื้อเมล็ด: " .. Settings.SelectedSeed)
|
||
for i = 1, 10 do
|
||
BuySeed(Settings.SelectedSeed)
|
||
wait(0.1)
|
||
end
|
||
end
|
||
return
|
||
end
|
||
|
||
local Count = SeedData.Count
|
||
local Tool = SeedData.Tool
|
||
|
||
-- Equip the tool
|
||
local Character = LocalPlayer.Character
|
||
if Character and Tool.Parent == Backpack then
|
||
local Humanoid = Character:FindFirstChild("Humanoid")
|
||
if Humanoid then
|
||
Humanoid:EquipTool(Tool)
|
||
wait(0.5)
|
||
end
|
||
end
|
||
|
||
local Planted = 0
|
||
local MaxPlants = math.min(Count, Settings.MaxPlantsPerCycle)
|
||
|
||
if Settings.PlantRandom then
|
||
-- Plant at random points
|
||
local FarmLands = PlantLocations:GetChildren()
|
||
for i = 1, MaxPlants do
|
||
if not Settings.AutoPlant then break end
|
||
local FarmLand = FarmLands[math.random(1, #FarmLands)]
|
||
local LX1, LZ1, LX2, LZ2 = GetArea(FarmLand)
|
||
local X = math.random(LX1, LX2)
|
||
local Z = math.random(LZ1, LZ2)
|
||
local Point = Vector3.new(X, 4, Z)
|
||
if Plant(Point, Settings.SelectedSeed) then
|
||
Planted = Planted + 1
|
||
end
|
||
end
|
||
else
|
||
-- Plant in grid pattern
|
||
for X = X1, X2, 2 do
|
||
for Z = Z1, Z2, 2 do
|
||
if Planted >= MaxPlants or not Settings.AutoPlant then break end
|
||
local Point = Vector3.new(X, 0.13, Z)
|
||
if Plant(Point, Settings.SelectedSeed) then
|
||
Planted = Planted + 1
|
||
end
|
||
end
|
||
if Planted >= MaxPlants or not Settings.AutoPlant then break end
|
||
end
|
||
end
|
||
|
||
if Planted > 0 then
|
||
DebugPrint("🌱 ปลูก " .. Planted .. " เมล็ด " .. Settings.SelectedSeed)
|
||
end
|
||
end
|
||
|
||
-- Auto Harvest Loop with Speed Options
|
||
local function AutoHarvestLoop()
|
||
if not Settings.AutoHarvest then return end
|
||
|
||
local Plants = GetHarvestablePlants()
|
||
if #Plants == 0 then return end
|
||
|
||
local MaxHarvest = math.min(#Plants, Settings.MaxHarvestPerCycle)
|
||
local Harvested = 0
|
||
|
||
if Settings.HarvestSpeed == "Instant" then
|
||
-- โหมด Instant - เก็บทั้งหมดพร้อมกัน
|
||
for i = 1, MaxHarvest do
|
||
if not Settings.AutoHarvest then break end
|
||
spawn(function()
|
||
if HarvestPlant(Plants[i]) then
|
||
Harvested = Harvested + 1
|
||
end
|
||
end)
|
||
end
|
||
wait(0.1)
|
||
|
||
elseif Settings.HarvestSpeed == "Ultra Fast" then
|
||
-- โหมด Ultra Fast - แบ่งเป็น batch
|
||
local batchSize = 20
|
||
for i = 1, MaxHarvest, batchSize do
|
||
if not Settings.AutoHarvest then break end
|
||
|
||
for j = i, math.min(i + batchSize - 1, MaxHarvest) do
|
||
spawn(function()
|
||
if HarvestPlant(Plants[j]) then
|
||
Harvested = Harvested + 1
|
||
end
|
||
end)
|
||
end
|
||
wait(0.05)
|
||
end
|
||
|
||
elseif Settings.HarvestSpeed == "Fast" then
|
||
-- โหมด Fast - ลดค่า delay
|
||
for i = 1, MaxHarvest do
|
||
if not Settings.AutoHarvest then break end
|
||
if HarvestPlant(Plants[i]) then
|
||
Harvested = Harvested + 1
|
||
end
|
||
wait(0.01)
|
||
end
|
||
|
||
else
|
||
-- โหมด Normal
|
||
for i = 1, MaxHarvest do
|
||
if not Settings.AutoHarvest then break end
|
||
if HarvestPlant(Plants[i]) then
|
||
Harvested = Harvested + 1
|
||
end
|
||
wait(Settings.HarvestDelay)
|
||
end
|
||
end
|
||
|
||
if Harvested > 0 then
|
||
DebugPrint("🚜 เก็บเกี่ยว " .. Harvested .. " ต้น (" .. Settings.HarvestSpeed .. ")")
|
||
end
|
||
end
|
||
|
||
-- Auto Sell Loop
|
||
local function AutoSellLoop()
|
||
if not Settings.AutoSell then return end
|
||
|
||
local Crops = GetInvCrops()
|
||
if #Crops < Settings.SellThreshold then return end
|
||
|
||
DebugPrint("💰 ขาย " .. #Crops .. " ผลผลิต (เกณฑ์: " .. Settings.SellThreshold .. ")")
|
||
SellInventory()
|
||
end
|
||
|
||
-- Create Ultimate UI
|
||
local function CreateUltimateUI()
|
||
-- Remove old UI
|
||
local oldUI = PlayerGui:FindFirstChild("UltimateGaGFarmUI")
|
||
if oldUI then oldUI:Destroy() end
|
||
|
||
-- ScreenGui
|
||
local ScreenGui = Instance.new("ScreenGui")
|
||
ScreenGui.Name = "UltimateGaGFarmUI"
|
||
ScreenGui.Parent = PlayerGui
|
||
ScreenGui.ResetOnSpawn = false
|
||
ScreenGui.IgnoreGuiInset = true
|
||
|
||
_G.UltimateGaGFarmUI = ScreenGui
|
||
|
||
-- Main Frame
|
||
local MainFrame = Instance.new("Frame")
|
||
MainFrame.Name = "MainFrame"
|
||
MainFrame.Parent = ScreenGui
|
||
MainFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 25)
|
||
MainFrame.BorderSizePixel = 0
|
||
MainFrame.Position = UDim2.new(0, 50, 0, 50)
|
||
MainFrame.Size = UDim2.new(0, 400, 0, 600)
|
||
MainFrame.Active = true
|
||
MainFrame.Draggable = true
|
||
|
||
-- Corner and Stroke
|
||
local Corner = Instance.new("UICorner")
|
||
Corner.CornerRadius = UDim.new(0, 12)
|
||
Corner.Parent = MainFrame
|
||
|
||
local Stroke = Instance.new("UIStroke")
|
||
Stroke.Parent = MainFrame
|
||
Stroke.Color = Color3.fromRGB(0, 200, 255)
|
||
Stroke.Thickness = 2
|
||
|
||
-- Title Bar
|
||
local TitleBar = Instance.new("Frame")
|
||
TitleBar.Name = "TitleBar"
|
||
TitleBar.Parent = MainFrame
|
||
TitleBar.BackgroundColor3 = Color3.fromRGB(0, 150, 255)
|
||
TitleBar.BorderSizePixel = 0
|
||
TitleBar.Size = UDim2.new(1, 0, 0, 40)
|
||
|
||
local TitleCorner = Instance.new("UICorner")
|
||
TitleCorner.CornerRadius = UDim.new(0, 12)
|
||
TitleCorner.Parent = TitleBar
|
||
|
||
local Title = Instance.new("TextLabel")
|
||
Title.Parent = TitleBar
|
||
Title.BackgroundTransparency = 1
|
||
Title.Position = UDim2.new(0, 15, 0, 0)
|
||
Title.Size = UDim2.new(1, -50, 1, 0)
|
||
Title.Font = Enum.Font.SourceSansBold
|
||
Title.Text = "🌱 Ultimate GaG Auto Farm"
|
||
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
|
||
Title.TextSize = 18
|
||
Title.TextXAlignment = Enum.TextXAlignment.Left
|
||
|
||
-- Close Button
|
||
local CloseButton = Instance.new("TextButton")
|
||
CloseButton.Parent = TitleBar
|
||
CloseButton.BackgroundColor3 = Color3.fromRGB(255, 70, 70)
|
||
CloseButton.BorderSizePixel = 0
|
||
CloseButton.Position = UDim2.new(1, -35, 0, 5)
|
||
CloseButton.Size = UDim2.new(0, 30, 0, 30)
|
||
CloseButton.Font = Enum.Font.SourceSansBold
|
||
CloseButton.Text = "×"
|
||
CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
|
||
CloseButton.TextSize = 20
|
||
|
||
local CloseCorner = Instance.new("UICorner")
|
||
CloseCorner.CornerRadius = UDim.new(0, 6)
|
||
CloseCorner.Parent = CloseButton
|
||
|
||
-- Content Frame with Scroll
|
||
local ContentFrame = Instance.new("ScrollingFrame")
|
||
ContentFrame.Parent = MainFrame
|
||
ContentFrame.BackgroundTransparency = 1
|
||
ContentFrame.Position = UDim2.new(0, 15, 0, 50)
|
||
ContentFrame.Size = UDim2.new(1, -30, 1, -70)
|
||
ContentFrame.CanvasSize = UDim2.new(0, 0, 0, 1200)
|
||
ContentFrame.ScrollBarThickness = 8
|
||
ContentFrame.ScrollBarImageColor3 = Color3.fromRGB(0, 150, 255)
|
||
|
||
-- Helper Functions for UI
|
||
local function CreateSection(parent, title, yPos)
|
||
local Section = Instance.new("Frame")
|
||
Section.Parent = parent
|
||
Section.BackgroundColor3 = Color3.fromRGB(30, 30, 35)
|
||
Section.BorderSizePixel = 0
|
||
Section.Position = UDim2.new(0, 0, 0, yPos)
|
||
Section.Size = UDim2.new(1, -10, 0, 150)
|
||
|
||
local SectionCorner = Instance.new("UICorner")
|
||
SectionCorner.CornerRadius = UDim.new(0, 8)
|
||
SectionCorner.Parent = Section
|
||
|
||
local SectionStroke = Instance.new("UIStroke")
|
||
SectionStroke.Parent = Section
|
||
SectionStroke.Color = Color3.fromRGB(60, 60, 70)
|
||
SectionStroke.Thickness = 1
|
||
|
||
local SectionTitle = Instance.new("TextLabel")
|
||
SectionTitle.Parent = Section
|
||
SectionTitle.BackgroundColor3 = Color3.fromRGB(0, 150, 255)
|
||
SectionTitle.BorderSizePixel = 0
|
||
SectionTitle.Size = UDim2.new(1, 0, 0, 30)
|
||
SectionTitle.Font = Enum.Font.SourceSansBold
|
||
SectionTitle.Text = title
|
||
SectionTitle.TextColor3 = Color3.fromRGB(255, 255, 255)
|
||
SectionTitle.TextSize = 14
|
||
|
||
local SectionTitleCorner = Instance.new("UICorner")
|
||
SectionTitleCorner.CornerRadius = UDim.new(0, 8)
|
||
SectionTitleCorner.Parent = SectionTitle
|
||
|
||
return Section
|
||
end
|
||
|
||
local function CreateToggle(parent, text, yPos, callback, defaultState)
|
||
local ToggleFrame = Instance.new("Frame")
|
||
ToggleFrame.Parent = parent
|
||
ToggleFrame.BackgroundTransparency = 1
|
||
ToggleFrame.Position = UDim2.new(0, 10, 0, yPos)
|
||
ToggleFrame.Size = UDim2.new(1, -20, 0, 25)
|
||
|
||
local Label = Instance.new("TextLabel")
|
||
Label.Parent = ToggleFrame
|
||
Label.BackgroundTransparency = 1
|
||
Label.Position = UDim2.new(0, 0, 0, 0)
|
||
Label.Size = UDim2.new(1, -60, 1, 0)
|
||
Label.Font = Enum.Font.SourceSans
|
||
Label.Text = text
|
||
Label.TextColor3 = Color3.fromRGB(255, 255, 255)
|
||
Label.TextSize = 12
|
||
Label.TextXAlignment = Enum.TextXAlignment.Left
|
||
|
||
local Toggle = Instance.new("TextButton")
|
||
Toggle.Parent = ToggleFrame
|
||
Toggle.BackgroundColor3 = defaultState and Color3.fromRGB(0, 200, 100) or Color3.fromRGB(200, 100, 100)
|
||
Toggle.BorderSizePixel = 0
|
||
Toggle.Position = UDim2.new(1, -55, 0, 2)
|
||
Toggle.Size = UDim2.new(0, 50, 0, 20)
|
||
Toggle.Font = Enum.Font.SourceSansBold
|
||
Toggle.Text = defaultState and "เปิด" or "ปิด"
|
||
Toggle.TextColor3 = Color3.fromRGB(255, 255, 255)
|
||
Toggle.TextSize = 10
|
||
|
||
local ToggleCorner = Instance.new("UICorner")
|
||
ToggleCorner.CornerRadius = UDim.new(0, 4)
|
||
ToggleCorner.Parent = Toggle
|
||
|
||
local isOn = defaultState or false
|
||
Toggle.MouseButton1Click:Connect(function()
|
||
isOn = not isOn
|
||
Toggle.Text = isOn and "เปิด" or "ปิด"
|
||
Toggle.BackgroundColor3 = isOn and Color3.fromRGB(0, 200, 100) or Color3.fromRGB(200, 100, 100)
|
||
if callback then callback(isOn) end
|
||
end)
|
||
|
||
return Toggle
|
||
end
|
||
|
||
local function CreateDropdown(parent, text, yPos, options, callback, defaultValue)
|
||
local DropdownFrame = Instance.new("Frame")
|
||
DropdownFrame.Parent = parent
|
||
DropdownFrame.BackgroundTransparency = 1
|
||
DropdownFrame.Position = UDim2.new(0, 10, 0, yPos)
|
||
DropdownFrame.Size = UDim2.new(1, -20, 0, 25)
|
||
|
||
local Label = Instance.new("TextLabel")
|
||
Label.Parent = DropdownFrame
|
||
Label.BackgroundTransparency = 1
|
||
Label.Position = UDim2.new(0, 0, 0, 0)
|
||
Label.Size = UDim2.new(0.5, 0, 1, 0)
|
||
Label.Font = Enum.Font.SourceSans
|
||
Label.Text = text
|
||
Label.TextColor3 = Color3.fromRGB(255, 255, 255)
|
||
Label.TextSize = 12
|
||
Label.TextXAlignment = Enum.TextXAlignment.Left
|
||
|
||
local DropdownButton = Instance.new("TextButton")
|
||
DropdownButton.Parent = DropdownFrame
|
||
DropdownButton.BackgroundColor3 = Color3.fromRGB(50, 50, 60)
|
||
DropdownButton.BorderSizePixel = 0
|
||
DropdownButton.Position = UDim2.new(0.5, 5, 0, 2)
|
||
DropdownButton.Size = UDim2.new(0.5, -10, 0, 20)
|
||
DropdownButton.Font = Enum.Font.SourceSans
|
||
DropdownButton.Text = defaultValue or options[1] or "เลือก"
|
||
DropdownButton.TextColor3 = Color3.fromRGB(255, 255, 255)
|
||
DropdownButton.TextSize = 10
|
||
|
||
local DropdownCorner = Instance.new("UICorner")
|
||
DropdownCorner.CornerRadius = UDim.new(0, 4)
|
||
DropdownCorner.Parent = DropdownButton
|
||
|
||
local DropdownList = Instance.new("Frame")
|
||
DropdownList.Parent = DropdownFrame
|
||
DropdownList.BackgroundColor3 = Color3.fromRGB(40, 40, 50)
|
||
DropdownList.BorderSizePixel = 0
|
||
DropdownList.Position = UDim2.new(0.5, 5, 0, 25)
|
||
DropdownList.Size = UDim2.new(0.5, -10, 0, #options * 20)
|
||
DropdownList.Visible = false
|
||
DropdownList.ZIndex = 10
|
||
|
||
local ListCorner = Instance.new("UICorner")
|
||
ListCorner.CornerRadius = UDim.new(0, 4)
|
||
ListCorner.Parent = DropdownList
|
||
|
||
local isOpen = false
|
||
|
||
DropdownButton.MouseButton1Click:Connect(function()
|
||
isOpen = not isOpen
|
||
DropdownList.Visible = isOpen
|
||
end)
|
||
|
||
for i, option in ipairs(options) do
|
||
local OptionButton = Instance.new("TextButton")
|
||
OptionButton.Parent = DropdownList
|
||
OptionButton.BackgroundColor3 = Color3.fromRGB(40, 40, 50)
|
||
OptionButton.BorderSizePixel = 0
|
||
OptionButton.Position = UDim2.new(0, 0, 0, (i-1) * 20)
|
||
OptionButton.Size = UDim2.new(1, 0, 0, 20)
|
||
OptionButton.Font = Enum.Font.SourceSans
|
||
OptionButton.Text = option
|
||
OptionButton.TextColor3 = Color3.fromRGB(255, 255, 255)
|
||
OptionButton.TextSize = 10
|
||
OptionButton.ZIndex = 11
|
||
|
||
OptionButton.MouseEnter:Connect(function()
|
||
OptionButton.BackgroundColor3 = Color3.fromRGB(60, 60, 70)
|
||
end)
|
||
|
||
OptionButton.MouseLeave:Connect(function()
|
||
OptionButton.BackgroundColor3 = Color3.fromRGB(40, 40, 50)
|
||
end)
|
||
|
||
OptionButton.MouseButton1Click:Connect(function()
|
||
DropdownButton.Text = option
|
||
DropdownList.Visible = false
|
||
isOpen = false
|
||
if callback then callback(option) end
|
||
end)
|
||
end
|
||
|
||
return DropdownButton
|
||
end
|
||
|
||
local function CreateSlider(parent, text, yPos, min, max, default, callback)
|
||
local SliderFrame = Instance.new("Frame")
|
||
SliderFrame.Parent = parent
|
||
SliderFrame.BackgroundTransparency = 1
|
||
SliderFrame.Position = UDim2.new(0, 10, 0, yPos)
|
||
SliderFrame.Size = UDim2.new(1, -20, 0, 25)
|
||
|
||
local Label = Instance.new("TextLabel")
|
||
Label.Parent = SliderFrame
|
||
Label.BackgroundTransparency = 1
|
||
Label.Position = UDim2.new(0, 0, 0, 0)
|
||
Label.Size = UDim2.new(0.4, 0, 1, 0)
|
||
Label.Font = Enum.Font.SourceSans
|
||
Label.Text = text
|
||
Label.TextColor3 = Color3.fromRGB(255, 255, 255)
|
||
Label.TextSize = 12
|
||
Label.TextXAlignment = Enum.TextXAlignment.Left
|
||
|
||
local SliderBG = Instance.new("Frame")
|
||
SliderBG.Parent = SliderFrame
|
||
SliderBG.BackgroundColor3 = Color3.fromRGB(50, 50, 60)
|
||
SliderBG.BorderSizePixel = 0
|
||
SliderBG.Position = UDim2.new(0.4, 5, 0, 8)
|
||
SliderBG.Size = UDim2.new(0.4, 0, 0, 8)
|
||
|
||
local SliderBGCorner = Instance.new("UICorner")
|
||
SliderBGCorner.CornerRadius = UDim.new(0, 4)
|
||
SliderBGCorner.Parent = SliderBG
|
||
|
||
local SliderFill = Instance.new("Frame")
|
||
SliderFill.Parent = SliderBG
|
||
SliderFill.BackgroundColor3 = Color3.fromRGB(0, 150, 255)
|
||
SliderFill.BorderSizePixel = 0
|
||
SliderFill.Size = UDim2.new((default - min) / (max - min), 0, 1, 0)
|
||
|
||
local SliderFillCorner = Instance.new("UICorner")
|
||
SliderFillCorner.CornerRadius = UDim.new(0, 4)
|
||
SliderFillCorner.Parent = SliderFill
|
||
|
||
local ValueLabel = Instance.new("TextLabel")
|
||
ValueLabel.Parent = SliderFrame
|
||
ValueLabel.BackgroundTransparency = 1
|
||
ValueLabel.Position = UDim2.new(0.8, 10, 0, 0)
|
||
ValueLabel.Size = UDim2.new(0.2, -10, 1, 0)
|
||
ValueLabel.Font = Enum.Font.SourceSans
|
||
ValueLabel.Text = tostring(default)
|
||
ValueLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
|
||
ValueLabel.TextSize = 12
|
||
|
||
local currentValue = default
|
||
|
||
local function UpdateSlider(value)
|
||
currentValue = math.clamp(value, min, max)
|
||
local percentage = (currentValue - min) / (max - min)
|
||
SliderFill.Size = UDim2.new(percentage, 0, 1, 0)
|
||
ValueLabel.Text = tostring(currentValue)
|
||
if callback then callback(currentValue) end
|
||
end
|
||
|
||
local dragging = false
|
||
|
||
SliderBG.InputBegan:Connect(function(input)
|
||
if input.UserInputType == Enum.UserInputType.MouseButton1 then
|
||
dragging = true
|
||
end
|
||
end)
|
||
|
||
UserInputService.InputEnded:Connect(function(input)
|
||
if input.UserInputType == Enum.UserInputType.MouseButton1 then
|
||
dragging = false
|
||
end
|
||
end)
|
||
|
||
UserInputService.InputChanged:Connect(function(input)
|
||
if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
|
||
local mouse = Players.LocalPlayer:GetMouse()
|
||
local relativeX = mouse.X - SliderBG.AbsolutePosition.X
|
||
local percentage = math.clamp(relativeX / SliderBG.AbsoluteSize.X, 0, 1)
|
||
local value = min + (max - min) * percentage
|
||
UpdateSlider(math.floor(value * 100) / 100) -- Round to 2 decimal places
|
||
end
|
||
end)
|
||
|
||
return UpdateSlider
|
||
end
|
||
|
||
-- Create Sections
|
||
local yPos = 10
|
||
|
||
-- Main Controls Section
|
||
local MainSection = CreateSection(ContentFrame, "🎮 การควบคุมหลัก", yPos)
|
||
|
||
CreateToggle(MainSection, "🌱 ปลูกอัตโนมัติ", 35, function(value)
|
||
Settings.AutoPlant = value
|
||
DebugPrint("🌱 ปลูกอัตโนมัติ: " .. (value and "เปิด" or "ปิด"))
|
||
end)
|
||
|
||
CreateToggle(MainSection, "🚜 เก็บเกี่ยวอัตโนมัติ", 65, function(value)
|
||
Settings.AutoHarvest = value
|
||
DebugPrint("🚜 เก็บเกี่ยวอัตโนมัติ: " .. (value and "เปิด" or "ปิด"))
|
||
end)
|
||
|
||
CreateToggle(MainSection, "💰 ขายอัตโนมัติ", 95, function(value)
|
||
Settings.AutoSell = value
|
||
DebugPrint("💰 ขายอัตโนมัติ: " .. (value and "เปิด" or "ปิด"))
|
||
end)
|
||
|
||
CreateToggle(MainSection, "🛒 ซื้อเมล็ดอัตโนมัติ", 125, function(value)
|
||
Settings.AutoBuy = value
|
||
DebugPrint("🛒 ซื้อเมล็ดอัตโนมัติ: " .. (value and "เปิด" or "ปิด"))
|
||
end)
|
||
|
||
yPos = yPos + 170
|
||
|
||
-- Plant Settings Section
|
||
local PlantSection = CreateSection(ContentFrame, "🌱 การตั้งค่าการปลูก", yPos)
|
||
|
||
local seedOptions = {"Carrot", "Strawberry", "Blueberry", "Tomato", "Corn", "Watermelon", "Pumpkin", "Apple", "Coconut", "Mango"}
|
||
CreateDropdown(PlantSection, "เมล็ดพันธุ์:", 35, seedOptions, function(value)
|
||
Settings.SelectedSeed = value
|
||
DebugPrint("🌱 เลือกเมล็ด: " .. value)
|
||
end, Settings.SelectedSeed)
|
||
|
||
CreateToggle(PlantSection, "🎲 ปลูกแบบสุ่ม", 65, function(value)
|
||
Settings.PlantRandom = value
|
||
DebugPrint("🎲 ปลูกสุ่ม: " .. (value and "เปิด" or "ปิด"))
|
||
end)
|
||
|
||
CreateSlider(PlantSection, "ความเร็วปลูก:", 95, 0, 1, Settings.PlantDelay, function(value)
|
||
Settings.PlantDelay = value
|
||
DebugPrint("🌱 ความเร็วปลูก: " .. value)
|
||
end)
|
||
|
||
CreateSlider(PlantSection, "จำนวนปลูก/รอบ:", 125, 10, 100, Settings.MaxPlantsPerCycle, function(value)
|
||
Settings.MaxPlantsPerCycle = math.floor(value)
|
||
DebugPrint("🌱 จำนวนปลูก/รอบ: " .. Settings.MaxPlantsPerCycle)
|
||
end)
|
||
|
||
yPos = yPos + 170
|
||
|
||
-- Harvest Settings Section
|
||
local HarvestSection = CreateSection(ContentFrame, "🚜 การตั้งค่าการเก็บเกี่ยว", yPos)
|
||
|
||
CreateToggle(HarvestSection, "🌍 เก็บทุกฟาร์ม", 35, function(value)
|
||
Settings.HarvestAll = value
|
||
DebugPrint("🌍 เก็บทุกฟาร์ม: " .. (value and "เปิด" or "ปิด"))
|
||
end, Settings.HarvestAll)
|
||
|
||
local speedOptions = {"Normal", "Fast", "Ultra Fast", "Instant"}
|
||
CreateDropdown(HarvestSection, "ความเร็วเก็บ:", 65, speedOptions, function(value)
|
||
Settings.HarvestSpeed = value
|
||
DebugPrint("🚜 ความเร็วเก็บ: " .. value)
|
||
end, Settings.HarvestSpeed)
|
||
|
||
CreateSlider(HarvestSection, "จำนวนเก็บ/รอบ:", 95, 50, 200, Settings.MaxHarvestPerCycle, function(value)
|
||
Settings.MaxHarvestPerCycle = math.floor(value)
|
||
DebugPrint("🚜 จำนวนเก็บ/รอบ: " .. Settings.MaxHarvestPerCycle)
|
||
end)
|
||
|
||
CreateSlider(HarvestSection, "ดีเลย์เก็บ:", 125, 0, 0.5, Settings.HarvestDelay, function(value)
|
||
Settings.HarvestDelay = value
|
||
DebugPrint("🚜 ดีเลย์เก็บ: " .. value)
|
||
end)
|
||
|
||
yPos = yPos + 170
|
||
|
||
-- Sell Settings Section
|
||
local SellSection = CreateSection(ContentFrame, "💰 การตั้งค่าการขาย", yPos)
|
||
|
||
CreateSlider(SellSection, "เกณฑ์ขาย:", 35, 5, 50, Settings.SellThreshold, function(value)
|
||
Settings.SellThreshold = math.floor(value)
|
||
DebugPrint("💰 เกณฑ์ขาย: " .. Settings.SellThreshold)
|
||
end)
|
||
|
||
CreateToggle(SellSection, "🚀 เทเลพอร์ตไปขาย", 65, function(value)
|
||
Settings.TeleportToSell = value
|
||
DebugPrint("🚀 เทเลพอร์ตไปขาย: " .. (value and "เปิด" or "ปิด"))
|
||
end, Settings.TeleportToSell)
|
||
|
||
CreateSlider(SellSection, "ความถี่ขาย:", 95, 3, 10, Settings.AutoSellDelay, function(value)
|
||
Settings.AutoSellDelay = value
|
||
DebugPrint("💰 ความถี่ขาย: " .. value)
|
||
end)
|
||
|
||
yPos = yPos + 140
|
||
|
||
-- Speed Settings Section
|
||
local SpeedSection = CreateSection(ContentFrame, "⚡ การตั้งค่าความเร็ว", yPos)
|
||
|
||
CreateSlider(SpeedSection, "ความเร็วหลัก:", 35, 0.1, 2, Settings.MainLoopSpeed, function(value)
|
||
Settings.MainLoopSpeed = value
|
||
DebugPrint("⚡ ความเร็วหลัก: " .. value)
|
||
end)
|
||
|
||
CreateSlider(SpeedSection, "ความเร็วปลูก:", 65, 2, 15, Settings.PlantLoopSpeed, function(value)
|
||
Settings.PlantLoopSpeed = value
|
||
DebugPrint("⚡ ความเร็วปลูก: " .. value)
|
||
end)
|
||
|
||
CreateSlider(SpeedSection, "ความเร็วเก็บ:", 95, 0.1, 2, Settings.HarvestLoopSpeed, function(value)
|
||
Settings.HarvestLoopSpeed = value
|
||
DebugPrint("⚡ ความเร็วเก็บ: " .. value)
|
||
end)
|
||
|
||
yPos = yPos + 140
|
||
|
||
-- Visual Settings Section
|
||
local VisualSection = CreateSection(ContentFrame, "🎨 การตั้งค่าการแสดงผล", yPos)
|
||
|
||
CreateToggle(VisualSection, "🔔 แสดงการแจ้งเตือน", 35, function(value)
|
||
Settings.ShowNotifications = value
|
||
DebugPrint("🔔 แสดงการแจ้งเตือน: " .. (value and "เปิด" or "ปิด"))
|
||
end, Settings.ShowNotifications)
|
||
|
||
CreateToggle(VisualSection, "🐛 แสดงข้อมูล Debug", 65, function(value)
|
||
Settings.ShowDebugInfo = value
|
||
DebugPrint("🐛 แสดงข้อมูล Debug: " .. (value and "เปิด" or "ปิด"))
|
||
end, Settings.ShowDebugInfo)
|
||
|
||
yPos = yPos + 120
|
||
|
||
-- Status Display
|
||
local StatusFrame = Instance.new("Frame")
|
||
StatusFrame.Parent = ContentFrame
|
||
StatusFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 30)
|
||
StatusFrame.BorderSizePixel = 0
|
||
StatusFrame.Position = UDim2.new(0, 0, 0, yPos)
|
||
StatusFrame.Size = UDim2.new(1, -10, 0, 120)
|
||
|
||
local StatusCorner = Instance.new("UICorner")
|
||
StatusCorner.CornerRadius = UDim.new(0, 8)
|
||
StatusCorner.Parent = StatusFrame
|
||
|
||
local StatusStroke = Instance.new("UIStroke")
|
||
StatusStroke.Parent = StatusFrame
|
||
StatusStroke.Color = Color3.fromRGB(0, 255, 100)
|
||
StatusStroke.Thickness = 2
|
||
|
||
local StatusTitle = Instance.new("TextLabel")
|
||
StatusTitle.Parent = StatusFrame
|
||
StatusTitle.BackgroundColor3 = Color3.fromRGB(0, 255, 100)
|
||
StatusTitle.BorderSizePixel = 0
|
||
StatusTitle.Size = UDim2.new(1, 0, 0, 25)
|
||
StatusTitle.Font = Enum.Font.SourceSansBold
|
||
StatusTitle.Text = "📊 สถานะระบบ"
|
||
StatusTitle.TextColor3 = Color3.fromRGB(0, 0, 0)
|
||
StatusTitle.TextSize = 14
|
||
|
||
local StatusTitleCorner = Instance.new("UICorner")
|
||
StatusTitleCorner.CornerRadius = UDim.new(0, 8)
|
||
StatusTitleCorner.Parent = StatusTitle
|
||
|
||
local StatusLabel = Instance.new("TextLabel")
|
||
StatusLabel.Parent = StatusFrame
|
||
StatusLabel.BackgroundTransparency = 1
|
||
StatusLabel.Position = UDim2.new(0, 10, 0, 30)
|
||
StatusLabel.Size = UDim2.new(1, -20, 1, -35)
|
||
StatusLabel.Font = Enum.Font.SourceSans
|
||
StatusLabel.Text = "สถานะ: พร้อมใช้งาน"
|
||
StatusLabel.TextColor3 = Color3.fromRGB(200, 255, 200)
|
||
StatusLabel.TextSize = 11
|
||
StatusLabel.TextYAlignment = Enum.TextYAlignment.Top
|
||
StatusLabel.TextXAlignment = Enum.TextXAlignment.Left
|
||
StatusLabel.TextWrapped = true
|
||
|
||
-- Event Handlers
|
||
CloseButton.MouseButton1Click:Connect(function()
|
||
-- Stop all systems
|
||
Settings.AutoPlant = false
|
||
Settings.AutoHarvest = false
|
||
Settings.AutoSell = false
|
||
|
||
ScreenGui:Destroy()
|
||
_G.UltimateGaGFarmLoaded = false
|
||
_G.UltimateGaGFarmUI = nil
|
||
DebugPrint("🌱 ปิดระบบ Ultimate Auto Farm")
|
||
end)
|
||
|
||
-- Status Update Loop
|
||
spawn(function()
|
||
while ScreenGui.Parent do
|
||
local OwnedSeeds = GetOwnedSeeds()
|
||
local Crops = GetInvCrops()
|
||
local Plants = GetHarvestablePlants()
|
||
|
||
local seedCount = OwnedSeeds[Settings.SelectedSeed] and OwnedSeeds[Settings.SelectedSeed].Count or 0
|
||
|
||
StatusLabel.Text = string.format(
|
||
"📊 สถานะปัจจุบัน:\n\n🌱 เมล็ด %s: %d\n🥕 ผลผลิต: %d / %d\n🚜 พืชที่เก็บได้: %d\n⚡ ความเร็วเก็บ: %s\n\n⚙️ ระบบที่เปิด:\n ปลูก: %s | เก็บ: %s | ขาย: %s | ซื้อ: %s\n เก็บทุกฟาร์ม: %s | การแจ้งเตือน: %s",
|
||
Settings.SelectedSeed,
|
||
seedCount,
|
||
#Crops,
|
||
Settings.SellThreshold,
|
||
#Plants,
|
||
Settings.HarvestSpeed,
|
||
Settings.AutoPlant and "เปิด" or "ปิด",
|
||
Settings.AutoHarvest and "เปิด" or "ปิด",
|
||
Settings.AutoSell and "เปิด" or "ปิด",
|
||
Settings.AutoBuy and "เปิด" or "ปิด",
|
||
Settings.HarvestAll and "เปิด" or "ปิด",
|
||
Settings.ShowNotifications and "เปิด" or "ปิด"
|
||
)
|
||
|
||
wait(1)
|
||
end
|
||
end)
|
||
|
||
print("✅ Ultimate UI created successfully!")
|
||
return ScreenGui
|
||
end
|
||
|
||
-- Main Loops
|
||
local function StartUltimateLoops()
|
||
print("🔄 Starting Ultimate loops...")
|
||
|
||
-- Auto Plant Loop
|
||
spawn(function()
|
||
while _G.UltimateGaGFarmLoaded do
|
||
if Settings.AutoPlant then
|
||
pcall(AutoPlantLoop)
|
||
end
|
||
wait(Settings.PlantLoopSpeed)
|
||
end
|
||
end)
|
||
|
||
-- Auto Harvest Loop
|
||
spawn(function()
|
||
while _G.UltimateGaGFarmLoaded do
|
||
if Settings.AutoHarvest then
|
||
pcall(AutoHarvestLoop)
|
||
end
|
||
wait(Settings.HarvestLoopSpeed)
|
||
end
|
||
end)
|
||
|
||
-- Auto Sell Loop
|
||
spawn(function()
|
||
while _G.UltimateGaGFarmLoaded do
|
||
if Settings.AutoSell then
|
||
pcall(AutoSellLoop)
|
||
end
|
||
wait(Settings.AutoSellDelay)
|
||
end
|
||
end)
|
||
|
||
print("✅ All Ultimate loops started")
|
||
end
|
||
|
||
-- Initialize Everything
|
||
print("🚀 Initializing Ultimate GaG Auto Farm...")
|
||
|
||
wait(1)
|
||
|
||
CreateUltimateUI()
|
||
StartUltimateLoops()
|
||
|
||
-- Success notification
|
||
Notify(
|
||
"🌱 Ultimate GaG Auto Farm",
|
||
"โหลดสำเร็จ! ✨\nฟาร์ม: " .. MyFarm.Name .. "\nพร้อมใช้งานทุกฟีเจอร์!",
|
||
5
|
||
)
|
||
|
||
print("✅ Ultimate GaG Auto Farm loaded successfully!")
|
||
print("🌱 ฟาร์ม: " .. MyFarm.Name)
|
||
print("📍 พื้นที่: " .. X1 .. "," .. Z1 .. " ถึง " .. X2 .. "," .. Z2)
|
||
print("⚡ ความเร็วเก็บ: " .. Settings.HarvestSpeed)
|
||
|
||
return {
|
||
Settings = Settings,
|
||
UI = _G.UltimateGaGFarmUI,
|
||
MyFarm = MyFarm,
|
||
Functions = {
|
||
AutoPlantLoop = AutoPlantLoop,
|
||
AutoHarvestLoop = AutoHarvestLoop,
|
||
AutoSellLoop = AutoSellLoop,
|
||
GetHarvestablePlants = GetHarvestablePlants,
|
||
GetOwnedSeeds = GetOwnedSeeds,
|
||
GetInvCrops = GetInvCrops
|
||
}
|
||
} |