@ MrEaKing(YT)
Cool you giving a try to the new LUA commands, I myself do when have some time left; here master LEE did a good job.
I thing maybe you being a bit redundant using ismoving var, since "GetGamePlayerControlMovement()" already do, ihmo.
my version
local oldplrPos = 0
local newplrPos = 0
local dis_traveled = 0
local tPlayerDX = 0
local tPlayerDY = 0
local tPlayerDZ = 0
local x,y,z = 0,0,0
function distance_traveled_init(e)
x = GetPlrObjectPositionX()
y = GetPlrObjectPositionY()
z = GetPlrObjectPositionZ()
oldplrPos = math.sqrt(math.abs(x^2)+math.abs(y^2)+math.abs(z^2))
end
function distance_traveled_main(e)
if GetGamePlayerControlMovement() then
tPlayerDX = (GetPlrObjectPositionX())
tPlayerDY = (GetPlrObjectPositionY())
tPlayerDZ = (GetPlrObjectPositionZ())
newplrPos = math.sqrt(math.abs(tPlayerDX^2)+math.abs(tPlayerDY^2)+math.abs(tPlayerDZ^2))
--Prompt(GetGamePlayerControlMovement() .. " x: " ..round(x,1) .. " y: " ..round(y,1) .. " z: " ..round(z,1))
--Prompt(GetGamePlayerControlMovement() .. " tPlayerDX: " ..round(tPlayerDX,1) .. " tPlayerDY: " ..round(tPlayerDY,1) .. " tPlayerDZ: " ..round(tPlayerDZ,1))
dis_traveled = newplrPos-oldplrPos
--Prompt(dis_traveled)
if dis_traveled>1000 then Prompt("1000k reached") end -- for testing purpose
end
end --main
function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz
OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4