# Nitro value

## Recommended Posts

Hello

Is it possible to somehow check the value of how much NOS you have in the vehicle because I am looking for but not which do not seem to work as if they were not at all.

I need this value to make a bar that will show how much nitro the vehicle has.

1 hour ago, Xwaw said:

Hello

Is it possible to somehow check the value of how much NOS you have in the vehicle because I am looking for but not which do not seem to work as if they were not at all.

I need this value to make a bar that will show how much nitro the vehicle has.

Heyo bro, from what I understand, I think it would be this function getVehicleNitroCount

7 hours ago, Kidzonio said:

Heyo bro, from what I understand, I think it would be this function getVehicleNitroCount

Ok but what is max value of this nitro?

```function drawNitroCounts()
local fCamX, fCamY, fCamZ = getCameraMatrix()
for _, v in ipairs(getElementsByType("vehicle")) do
if getVehicleUpgradeOnSlot(v, 8) then -- Check if the vehicle has nitro installed
local fX, fY, fZ = getElementPosition(v)
local fCamX, fCamY, fCamZ = getCameraMatrix()
local fX2, fY2 = getScreenFromWorldPosition(fX, fY, fZ + 0.85, 0.08)
if fX2 then
local fDistance = getDistanceBetweenPoints3D(fX, fY, fZ, fCamX, fCamY, fCamZ)
if fDistance < 60 then
if isLineOfSightClear(fCamX, fCamY, fCamZ, fX, fY, fZ, true, false, false, true, false) then
local pVehicle = getPedOccupiedVehicle(localPlayer)
if not pVehicle or pVehicle ~= v then
local fScale = (60 / fDistance) * 0.7
local iNitroCount = getVehicleNitroCount(v)
dxDrawText("Nitro count: " .. iNitroCount, fX2 + 1, fY2 + 1, fX2 + 1, fY2 + 1, tocolor(0, 0, 255), fScale, "default", "center", "bottom")
dxDrawText("Nitro count: " .. iNitroCount, fX2, fY2, fX2, fY2, tocolor(255, 255, 255), fScale, "default", "center", "bottom")
end
end
end
end
end
end
end
Edited by Sr.black
```function drawNitroBar()
local vehicle = getPedOccupiedVehicle(localPlayer)
if isElement(vehicle) and getVehicleUpgradeOnSlot (vehicle, 8) then
local nosLevel = getVehicleNitroLevel(vehicle)
local screenWidth, screenHeight = guiGetScreenSize()
local barWidth = 200
local barHeight = 20
local barX = (screenWidth - barWidth) / 2
local barY = 20
local nosPercent = math.floor(nosLevel * 100)
local textX = barX + (barWidth / 2)
local textY = barY
local textSize = 1
local textColor = tocolor(255, 255, 255, 255)
local textFont = "default"
local textAlignment = "center"
r = nosPercent >= 100 and 0 or nosPercent >= 80 and 0 or nosPercent >= 50 and 255 or nosPercent >= 30 and 255 or nosPercent >= 20 and 200 or 150
g = nosPercent >= 100 and 255 or nosPercent >= 80 and 200 or nosPercent >= 50 and 165 or nosPercent >= 30 and 0 or nosPercent >= 20 and 0 or 0
b = nosPercent >= 100 and 0 or nosPercent >= 80 and 0 or nosPercent >= 50 and 0 or nosPercent >= 30 and 0 or nosPercent >= 20 and 0 or 0
dxDrawRectangle(barX, barY, barWidth, barHeight, tocolor(0, 0, 0, 128))
dxDrawRectangle(barX, barY, barWidth * nosLevel, barHeight, tocolor(r, g, b, 192))
dxDrawText(nosPercent.."%", textX, textY, textX, textY, textColor, textSize, textFont, textAlignment)
end
end

pretty sure u wanted it like that

Edited by FLUSHBICEPS
• 1

## Create an account

Register a new account