Включение / Выключение бота

angel.wqxx

Новичок
Автор темы
8
2
Помогите сделать чтоб за командой /fbot бот включался и выключался
(И если сможете сделайте код что после активации бот бежал на кординаты, и напишите куда вписывать корды) и после команды еще раз выключение скрипта красным цветом код: FF0000 спасибо заранее!!!


FarmBot:
require "lib.moonloader"
local keys = require "vkeys"

function main()
  repeat wait(0) until isSampAvailable()
  wait(0)
  sampAddChatMessage("БОТ: Ферма [BY ANGEL]", 0x00DD00)
  sampRegisterChatCommand("fbot", fbot)
  thread = lua_thread.create_suspended(thread_function)
  while true do
    wait(0)
  end
end

function fbot(arg)
  sampAddChatMessage("{00FF00}Бот на Ферму Включен!")
end
 
  • Влюблен
Реакции: Vespan

Anti...

Активный
268
31
Вроде так. А вообще лучше юзать https://www.blast.hk/threads/195760/

Lua:
local keys = require "vkeys"
local status = false
local thread

function main()
  while not isSampAvailable() do wait(0) end
 
  sampAddChatMessage("БОТ: Ферма [BY ANGEL]", 0x00DD00)
    sampRegisterChatCommand("fbot", fbot)
    wait(-1)
end

function fbot(arg)
  status = not status
  sampAddChatMessage(status and  "{00FF00}Бот на Ферму Включен!" or "{FF0000}Бот на Ферму Выключен!", -1)
 
  if status then
    thread= lua_thread.create(function()
      runToPoint(1337.228, 720.000)
    end)
else
thread:terminate()
  end
end

function runToPoint(tox, toy)
    local x, y, z = getCharCoordinates(PLAYER_PED)
    local angle = getHeadingFromVector2d(tox - x, toy - y)
    local xAngle = math.random(-50, 50)/100
    setCameraPositionUnfixed(xAngle, math.rad(angle - 90))
    stopRun = false
    while getDistanceBetweenCoords2d(x, y, tox, toy) > 0.8 do
        setGameKeyState(1, -255)
        --setGameKeyState(16, 1)
        wait(1)
        x, y, z = getCharCoordinates(PLAYER_PED)
        angle = getHeadingFromVector2d(tox - x, toy - y)
        setCameraPositionUnfixed(xAngle, math.rad(angle - 90))
        if stopRun then
            stopRun = false
            break
        end
    end
end
 
  • Клоун
Реакции: minxty

angel.wqxx

Новичок
Автор темы
8
2
Вроде так. А вообще лучше юзать https://www.blast.hk/threads/195760/

Lua:
local keys = require "vkeys"
local status = false
local thread

function main()
  while not isSampAvailable() do wait(0) end
 
  sampAddChatMessage("БОТ: Ферма [BY ANGEL]", 0x00DD00)
    sampRegisterChatCommand("fbot", fbot)
    wait(-1)
end

function fbot(arg)
  status = not status
  sampAddChatMessage(status and  "{00FF00}Бот на Ферму Включен!" or "{FF0000}Бот на Ферму Выключен!", -1)
 
  if status then
    thread= lua_thread.create(function()
      runToPoint(1337.228, 720.000)
    end)
else
thread:terminate()
  end
end

function runToPoint(tox, toy)
    local x, y, z = getCharCoordinates(PLAYER_PED)
    local angle = getHeadingFromVector2d(tox - x, toy - y)
    local xAngle = math.random(-50, 50)/100
    setCameraPositionUnfixed(xAngle, math.rad(angle - 90))
    stopRun = false
    while getDistanceBetweenCoords2d(x, y, tox, toy) > 0.8 do
        setGameKeyState(1, -255)
        --setGameKeyState(16, 1)
        wait(1)
        x, y, z = getCharCoordinates(PLAYER_PED)
        angle = getHeadingFromVector2d(tox - x, toy - y)
        setCameraPositionUnfixed(xAngle, math.rad(angle - 90))
        if stopRun then
            stopRun = false
            break
        end
    end
end
спасибо тебе огромное