Skip to content

Instantly share code, notes, and snippets.

@JeViCo
Created September 6, 2023 20:37
Show Gist options
  • Save JeViCo/7fcd5545d97820af95d6a42621c83c41 to your computer and use it in GitHub Desktop.
Save JeViCo/7fcd5545d97820af95d6a42621c83c41 to your computer and use it in GitHub Desktop.
local recording = false
local dist = 0
local time = 0
local position
local timer
function updateDist()
dist = dist + getDistanceBetweenPoints3D(position, me.vehicle.position)
position = me.vehicle.position
end
bindKey("num_5", "down", function()
if not recording then
dist = 0
time = getTickCount()
position = me.vehicle.position
timer = setTimer(updateDist, 1000, 0)
recording = true
exports.ui_hud:showInfo("Запись запущена")
else
if (isTimer(timer)) then
killTimer(timer)
end
recording = false
exports.ui_hud:showInfo("Запись остановлена")
outputConsole(inspect({"Пройдено", dist, "Время", getTickCount() - time}))
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment