Hi there, mates!
Today i introduce you additional vehicle speedometer (as you can see from topic header, lol)
Its drawed up with sprites and in miles per km, because it is U.S. speed measure unit, as i know (but i add km/h for other people who want to know their speed in this measure unit).
Some credits
All sources taken from public (speedometer texture from google, except from needle, how to know MPH entity speed from nativeDB). Original gradations was replaced by me for kind of synchronization with original FPS speedometer, but some times we have some differences between them - i think (+/-) 1-2 mph is not critical.
Video
Screenshots
Synchronization example with original car speedometer:
Random screenshot:
Original code prewiev
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsPedSittingInAnyVehicle(GetPlayerPed(-1)) then
local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
if DoesEntityExist(vehicle) and not IsEntityDead(vehicle) then
if not HasStreamedTextureDictLoaded("speedo") then
RequestStreamedTextureDict("speedo", true) -- upload it
while not HasStreamedTextureDictLoaded("speedo") do
Wait(0)
end
else
-- everything is ok
local degree = 0
local step = 2.05833
if GetEntitySpeed(vehicle) > 0 then degree=(GetEntitySpeed(vehicle)*2.236936)*step end
DrawSprite("speedo", "speedom_003", 0.898,0.752,0.16,0.245, 0.0, 255, 255, 255, 255)
if degree > 247 then degree=247 end
DrawSprite("speedo", "needle_003", 0.898,0.755,0.116,0.15,43.00001+degree, 255, 255, 255, 200)
if IsControlPressed(1, 216) then DrawSprite("speedo", "brakeson_001", 0.83,0.815,0.02,0.025, 0.0, 255, 255, 255, 255)
else DrawSprite("speedo", "brakeson_002", 0.83,0.815,0.02,0.025, 0.0, 255, 255, 255, 255) end
end
end
end
end
end)
#Versions
By me:
This is first aplha version, maybe i will update this script later with some special hud components.
Download link: in download section below.
Bugs
I repeat, this is aplha version. What does it means? It means some random bugs can be available, so if you find some - write me or made your own update and post it here.
Also
No credis required and you can use it however you want. Sorry for my english, traditionally.
If you want to update this resouce - you’re welcome! Post your version (with comments) here and I`ll add it in this topic with your name.
Links
Download resource: HERE (165 KB)
Unofficial wiki: HERE
My project: HERE
My pastebin: HERE