Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local HttpService = game:GetService("HttpService")
- local Players = game:GetService("Players")
- -- Создание RemoteEvent для взаимодействия с клиентом
- local ChatSpamEvent = Instance.new("RemoteEvent", ReplicatedStorage)
- ChatSpamEvent.Name = "ChatSpamEvent"
- local pastebinUrls = {
- RU = "https://pastebin.com/raw/RV6uSFJD",
- EN = "https://pastebin.com/raw/DnWCgXUV"
- }
- -- Функция для получения данных из Pastebin
- local function getLinesFromPastebin(url)
- local success, response = pcall(function()
- return HttpService:GetAsync(url)
- end)
- if success then
- return response:split("\n")
- else
- warn("Ошибка при получении данных: " .. response)
- return {}
- end
- end
- -- Обработчик события от клиента
- ChatSpamEvent.OnServerEvent:Connect(function(player, language)
- local lines = getLinesFromPastebin(pastebinUrls[language])
- if #lines == 0 then
- player:SendNotification({Title = "Ошибка", Text = "Нет сообщений для спама."})
- return
- end
- for _, line in ipairs(lines) do
- player:Chat(line)
- wait(1) -- Задержка между сообщениями
- end
- end)
- -- Создание GUI для клиента
- local function createGui(player)
- local ScreenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
- local StartButton = Instance.new("TextButton", ScreenGui)
- local StopButton = Instance.new("TextButton", ScreenGui)
- local RULanguageButton = Instance.new("TextButton", ScreenGui)
- local ENLanguageButton = Instance.new("TextButton", ScreenGui)
- local CloseButton = Instance.new("TextButton", ScreenGui)
- -- Настройка кнопок
- StartButton.Size = UDim2.new(0, 100, 0, 50)
- StartButton.Position = UDim2.new(0.5, -50, 0.5, -60)
- StartButton.Text = "Старт"
- StopButton.Size = UDim2.new(0, 100, 0, 50)
- StopButton.Position = UDim2.new(0.5, -50, 0.5, 0)
- StopButton.Text = "Стоп"
- RULanguageButton.Size = UDim2.new(0, 100, 0, 50)
- RULanguageButton.Position = UDim2.new(0.5, -150, 0.5, -60)
- RULanguageButton.Text = "RU"
- ENLanguageButton.Size = UDim2.new(0, 100, 0, 50)
- ENLanguageButton.Position = UDim2.new(0.5, 50, 0.5, -60)
- ENLanguageButton.Text = "EN"
- CloseButton.Size = UDim2.new(0, 100, 0, 50)
- CloseButton.Position = UDim2.new(0.5, -50, 0.5, 60)
- CloseButton.Text = "Закрыть"
- -- Переменные для управления языком
- local language = "EN"
- RULanguageButton.MouseButton1Click:Connect(function()
- language = "RU"
- end)
- ENLanguageButton.MouseButton1Click:Connect(function()
- language = "EN"
- end)
- StartButton.MouseButton1Click:Connect(function()
- ChatSpamEvent:FireServer(language) -- Отправка языка на сервер
- end)
- StopButton.MouseButton1Click:Connect(function()
- -- Здесь можно добавить логику остановки, если это необходимо
- end)
- CloseButton.MouseButton1Click:Connect(function()
- ScreenGui:Destroy() -- Закрытие GUI
- end)
- end
- -- Создание GUI для каждого игрока
- Players.PlayerAdded:Connect(function(player)
- createGui(player)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement