ТП в рандомную местность

Daniel_Govnocode

Активный
Автор темы
324
60
Версия MoonLoader
Другое
Как тепнуться в рандомное место на карте? Если юзать math.random то чо делать с координатной Z? Типо не везде одинаковая высота, можно оказаться под горой, в текстуре здания и т.д.
 
Решение
Если юзать math.random то чо делать с координатной Z?

дополняю
Lua:
function main()
    sampRegisterChatCommand("random", function()
        local x, y = math.random(-3000, 3000), math.random(-3000, 3000)
        requestCollision(x, y); loadScene(x, y, 999)
        local z = getGroundZFor3dCoord(x, y, 999)
        setCharCoordinates(1, x, y, z)
    end)
    wait(-1)
end

yung milonov

Известный
1,023
528
Если юзать math.random то чо делать с координатной Z?

дополняю
Lua:
function main()
    sampRegisterChatCommand("random", function()
        local x, y = math.random(-3000, 3000), math.random(-3000, 3000)
        requestCollision(x, y); loadScene(x, y, 999)
        local z = getGroundZFor3dCoord(x, y, 999)
        setCharCoordinates(1, x, y, z)
    end)
    wait(-1)
end
 
Последнее редактирование:
  • Нравится
Реакции: Daniel_Govnocode