отслеживание xyz

coldplugg.

Участник
Автор темы
180
22
Версия MoonLoader
.027.0-preview
извиняюсь за тупой вопрос, но как можно сделать отслеживание координат, типо если не на заданных, то пишет в чат, если на заданных, то ничего

желательно под раксамп
 

whyega52

Eblang головного мозга
Модератор
2,870
2,852
извиняюсь за тупой вопрос, но как можно сделать отслеживание координат, типо если не на заданных, то пишет в чат, если на заданных, то ничего

желательно под раксамп

Lua:
local utils

local Utils = {}
function Utils:new()   
    local public = {}               
        function public:getDistanceBetweenCoords3d(x1, y1, z1, x2, y2, z2)
            return math.sqrt((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2))
        end               

    setmetatable(public, self)
    self.__index = self; return public
end

registerHandler("onLoad", function()
    newTask(function()
        utils = Utils:new()
        local x, y, z = -1320, 500, 15 -- координаты, с которыми надо сверяться
        while true do wait(0)
            if utils:getDistanceBetweenCoords3d(x, y, z, getBotPosition()) <= 0.1 then
                print("Ты на нужных коордах")
            end
        end
    end
end
 
  • Bug
Реакции: paulohardy

coldplugg.

Участник
Автор темы
180
22
Lua:
local utils

local Utils = {}
function Utils:new()  
    local public = {}              
        function public:getDistanceBetweenCoords3d(x1, y1, z1, x2, y2, z2)
            return math.sqrt((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2))
        end              

    setmetatable(public, self)
    self.__index = self; return public
end

registerHandler("onLoad", function()
    newTask(function()
        utils = Utils:new()
        local x, y, z = -1320, 500, 15 -- координаты, с которыми надо сверяться
        while true do wait(0)
            if utils:getDistanceBetweenCoords3d(x, y, z, getBotPosition()) <= 0.1 then
                print("Ты на нужных коордах")
            end
        end
    end
end
getBotPosition nil
 

whyega52

Eblang головного мозга
Модератор
2,870
2,852
Lua:
require("addon")

function getDistanceBetweenCoords3d(x1, y1, z1, x2, y2, z2)
    return math.sqrt((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2)
end

registerHandler("onLoad", function()
    newTask(function()      
        local x, y, z = -1320, 500, 15
        while true do wait(0)
           if (getDistanceBetweenCoords3d(x, y, z, getBotPosition()) <= 0.1) then
               print("+")
           end
        end
    end)
end)
 

coldplugg.

Участник
Автор темы
180
22
Lua:
require("addon")

function getDistanceBetweenCoords3d(x1, y1, z1, x2, y2, z2)
    return math.sqrt((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2)
end

registerHandler("onLoad", function()
    newTask(function()     
        local x, y, z = -1320, 500, 15
        while true do wait(0)
           if (getDistanceBetweenCoords3d(x, y, z, getBotPosition()) <= 0.1) then
               print("+")
           end
        end
    end)
end)
также гетботпозишн ругается