Как заставить поехать бота на машине в определенную точку? Samp, Lua

Wer_tyn

Участник
Автор темы
46
0
Версия MoonLoader
.027.0-preview
Ищу способ чтобы бот мог ехать в определенную точку на транспорте samp, lua

Скрипты по записи маршрута и потом воспроизведения не кидайте

Только по воспроизведения заранее записанного маршрута
 

Wer_tyn

Участник
Автор темы
46
0

plalkeo

Известный
780
311
Можно пример кода езды на 10 координат? Я так понял тут можно указать только одну
ставишь на одни корды, время от времени чекаешь рядом ли с нужными кордами - другие и так по цепочке можешь
как вариант
 

chapo

чопа сребдс // TG/IG: @moujeek
Модератор
9,018
11,849
Можно пример кода?
ну примерно как то так
Lua:
local Vector3D = require('vector3d');
local points = {
    Vector3D(1, 1, 1),
    Vector3D(2, 2, 1),
    Vector3D(3, 3, 1),
    Vector3D(4, 4, 1),
};
local currentPoint;

-- start
currentPoint = 0;

-- loop
if (currentPoint) then
    local pos = Vector3D(getCarCoordinates(storeCarCharIsInNoSave(PLAYER_PED)));
    local currentPointPos = points[currentPoint];
    local dist = getDistanceBetweenCoords3d(pos.x, pos.y, pos.z, currentPointPos.x, currentPointPos.y, currentPointPos.z);
    if (dist <= 4) then
        currentPoint = currentPoint + 1;
        if (currentPoint > #points) then
            currentPoint = nil;
            print('Done!');
        else
            print('Point passed, next');
            taskCarDriveToCoord(...);
        end
    end
end
 

Wer_tyn

Участник
Автор темы
46
0
ну примерно как то так
Lua:
local Vector3D = require('vector3d');
local points = {
    Vector3D(1, 1, 1),
    Vector3D(2, 2, 1),
    Vector3D(3, 3, 1),
    Vector3D(4, 4, 1),
};
local currentPoint;

-- start
currentPoint = 0;

-- loop
if (currentPoint) then
    local pos = Vector3D(getCarCoordinates(storeCarCharIsInNoSave(PLAYER_PED)));
    local currentPointPos = points[currentPoint];
    local dist = getDistanceBetweenCoords3d(pos.x, pos.y, pos.z, currentPointPos.x, currentPointPos.y, currentPointPos.z);
    if (dist <= 4) then
        currentPoint = currentPoint + 1;
        if (currentPoint > #points) then
            currentPoint = nil;
            print('Done!');
        else
            print('Point passed, next');
            taskCarDriveToCoord(...);
        end
    end
end
Можно пример использования?

lua:17: attempt to index local 'currentPointPos' (a nil value)
stack traceback:
lua:17: in main chunk
[ML] (error) lua: Script died due to an error. (0F57B2F4)
 

kyrtion

Известный
1,084
388
Можно пример использования?

lua:17: attempt to index local 'currentPointPos' (a nil value)
stack traceback:
lua:17: in main chunk
[ML] (error) lua: Script died due to an error. (0F57B2F4)
скинь полный код, а то не поймем что ты хотел указать