require("lib.moonloader")
local sampev = require('lib.samp.events')
local maincolor = 0xFFFFFF
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand('testt', cmd_testt)
thread = lua_thread.create_suspended(thread_func)
while true do
wait(0)
end
end
function cmd_testt()
thread:run()
end
function thread_func()
local ttp = true
result, posX, posY, posZ = getTargetBlipCoordinates()
local plPosX, plPosY, plPosZ = getCharCoordinates(PLAYER_PED)
local rx, ry, rz = posX - plPosX, posY - plPosY, posZ - plPosZ
local dist = getDistanceBetweenCoords3d(posX, posY, posZ, plPosX, plPosY, plPosZ)
local steps = math.floor(dist / 10)
local path = {}
if result then
sampAddChatMessage(dist, -1)
sampAddChatMessage('X: ' .. plPosX - posX .. ' Y: ' .. plPosY - posY .. ' Z: ' .. plPosZ - posZ, -1)
for i = 1, steps do
path[#path+1] = {
x = plPosX + (rx / steps) * i,
y = plPosY + (ry / steps) * i,
z = plPosZ + (rz / steps) * i
}
end
path[#path+1] = {x = posX, y = posY, z = posZ}
for i = 1, steps do
wait(100)
setCharCoordinates(PLAYER_PED, path[i].x, path[i].y, path[i].z)
end
local px, py, pz = getCharCoordinates(PLAYER_PED)
if ttp then
sampProcessChatInput('/testt')
ttp = false
end
else
sampAddChatMessage('Marker is not found.', -1)
end
end