function coordmaster step depth depth_bool lua_thread create function

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function coordmaster(x, y, z, step, depth, depth_bool)
lua_thread.create(function()
freezeCharPosition(playerPed, true)
repeat
wait(50)
local mx, my, mz = getCharCoordinates(playerPed)
local floor = math.floor
if floor(mx) ~= floor(x) and floor(my) ~= floor(y) then
if floor(mz) ~= floor(depth) then
if math.abs(depth - mz) < step then
setCharCoordinatesNoOffset(playerPed, mx, my, depth)
else
if mz < depth then
setCharCoordinatesNoOffset(playerPed, mx, my, mz + step)
else
setCharCoordinatesNoOffset(playerPed, mx, my, mz - step)
end
end
else
if getDistanceBetweenCoords3d(mx, my, mz, x, y, depth) < step then
setCharCoordinatesNoOffset(playerPed, x, y, depth)
else
local angle = get_camera_direcion(x, y)
setCharHeading(playerPed, angle)
local mx = mx + step * math.sin(-math.rad(angle))
local my = my + step * math.cos(-math.rad(angle))
local mz = depth
setCharCoordinatesNoOffset(playerPed, mx, my, mz)
end
end
else
setCharCoordinatesNoOffset(playerPed, x, y, mz - step)
end
local dist = getDistanceBetweenCoords3d(mx, my, mz, x, y, z)
if dist < 5 then
setCharCoordinatesNoOffset(playerPed, x, y, z)
break
end
if math.random(1, 100) > 80 then sampForceOnfootSync() end
until false
freezeCharPosition(playerPed, false)
end)
end