Created
September 6, 2023 20:37
-
-
Save JeViCo/7fcd5545d97820af95d6a42621c83c41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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