Get Entity Speed (MPH)
Get Entity Speed (MPH)
Getting the speed of vehicles is easy once you know how! Rounding numbers and converting GTA’s units to MPH can be difficult for new developers.
client.lua
1
2
3
4
5
6
7
8
9
10
function GetSpeedOf(Entity)
if Entity == false then return 0 end
local Speed = GetEntitySpeed(Entity)
Speed = Speed * 2.2369 -- Convert to miles per hour
Speed = math.floor(Speed)
return Speed
end
References
This post is licensed under CC BY 4.0 by the author.