Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added LegacyFuel Version of cosmo_hud #5

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cosmo_hud/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Citizen.CreateThread(function()
local veh = GetVehiclePedIsUsing(PlayerPedId(), false)
local speed = math.floor(GetEntitySpeed(veh) * SpeedMultiplier)
local vehhash = GetEntityModel(veh)
local maxspeed = GetVehicleModelMaxSpeed(vehhash) * 3.6
local maxspeed = (GetVehicleModelMaxSpeed(vehhash) * SpeedMultiplier)
SendNUIMessage({speed = speed, maxspeed = maxspeed})
end
end
Expand Down Expand Up @@ -148,7 +148,7 @@ CreateThread(function()
if Config.ShowFuel == true then
if isDriving and IsPedInAnyVehicle(PlayerPedId(), true) then
local veh = GetVehiclePedIsUsing(PlayerPedId(), false)
local fuellevel = GetVehicleFuelLevel(veh)
local fuellevel = exports["LegacyFuel"]:GetFuel(veh)
SendNUIMessage({
action = "update_fuel",
fuel = fuellevel,
Expand Down
11 changes: 4 additions & 7 deletions cosmo_hud/html/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,12 @@ window.addEventListener("message", function (event) {
}

if (data.action == "update_fuel") {
let finalfuel = (data.fuel / 100) * 1.5385;
if (finalfuel > 0.9) {
FuelIndicator.animate(1.0);
} else if (finalfuel < 0.9) {
FuelIndicator.animate(finalfuel);
let finalfuel = (data.fuel / 100);
FuelIndicator.animate(finalfuel);
}
if (finalfuel < 0.2) {
if (finalfuel < 0.20) {
FuelIndicator.path.setAttribute("stroke", "red");
} else if (finalfuel > 0.2) {
} else if (finalfuel > 0.20) {
FuelIndicator.path.setAttribute("stroke", "white");
}
}
Expand Down