function main()
while true do
if testCheat('RR') then
playRoute('data')
end
wait(1)
end
end
function playRoute(route)
local data = readRoute(route)
if data then
for _, line in pairs(data) do
local x, y, sprint, jump = line:match('{(.*)}:{(.*)}:{(.*)}:{(.*)}')
if x and y and sprint and jump then
repeat
wait(0)
drawLine(x, y)
setGameKeyState(1, -128)
setCameraPos(x, y)
if sprint == 'sprint' then
setGameKeyState(16, 255)
elseif jump == 'jump' then
setGameKeyState(16, 0)
setGameKeyState(14, 255)
end
until locateCharOnFoot2d(PLAYER_PED, x, y, 1.5, 1.5, false)
end
end
else
sampAddChatMessage('cant open file', -1)
end
end
function setCameraPos(x, y)
local camX, camY, camZ = getActiveCameraCoordinates()
setCameraPositionUnfixed(0.0, (getHeadingFromVector2d(x - camX, y - camY) - 90.0) / 57.2957795)
end
function drawLine(x, y)
local posX, posY, posZ = getCharCoordinates(PLAYER_PED)
if isPointOnScreen(x, y, posZ, 0.0) then
local screenPosX, screenPosY = convert3DCoordsToScreen(x, y, posZ)
local charPosX, charPosY = convert3DCoordsToScreen(posX, posY, posZ)
renderDrawLine(charPosX, charPosY, screenPosX, screenPosY, 2, 0xFFFFFFFF)
renderDrawPolygon(screenPosX, screenPosY, 10, 10, 14, 0.0, 0xFF000000)
renderDrawPolygon(charPosX, charPosY, 10, 10, 14, 0.0, 0xFF000000)
end
end
function readRoute(route)
local file = io.open(string.format('moonloader/routes/%s.txt', route), 'r')
if file then
local data = {}
for line in file:lines() do
table.insert(data, line)
end
file:close()
return data
end
end