Jelentkezz be, hogy követhesd  
Követő(k) 0
impreZZa

[SCRIPT] Egyszerű kilométeróra / Simple speedometer

3 hozzászólás ebben a témában

K3P7D7L.jpg

local screenWidth, screenHeight = guiGetScreenSize()

addEventHandler("onClientRender", root, function()
	local vehicle = getPedOccupiedVehicle(localPlayer)

	if vehicle then
		local position = {getElementVelocity(vehicle)}
		local speed = math.sqrt(position[1]^2 + position[2]^2 + position[3]^2) * 180
		local string = math.floor(speed + 0.5)
		local bar = string / ((getVehicleHandling(vehicle)["maxVelocity"]-14) / 30)

		dxDrawText(string, screenWidth-230-2, screenHeight-150, _, _, tocolor(115, 177, 237), 1.2, "bankgothic")
		dxDrawText(string, screenWidth-230+2, screenHeight-150, _, _, tocolor(115, 177, 237), 1.2, "bankgothic")
		dxDrawText(string, screenWidth-230, screenHeight-150-2, _, _, tocolor(115, 177, 237), 1.2, "bankgothic")
		dxDrawText(string, screenWidth-230, screenHeight-150+2, _, _, tocolor(115, 177, 237), 1.2, "bankgothic")
		dxDrawText(string, screenWidth-230, screenHeight-150, _, _, _, 1.2, "bankgothic")

		dxDrawText("KM/H", screenWidth-120-2, screenHeight-150, _, _, tocolor(0, 0, 0, 200), 0.5, "bankgothic")
		dxDrawText("KM/H", screenWidth-120+2, screenHeight-150, _, _, tocolor(0, 0, 0, 200), 0.5, "bankgothic")
		dxDrawText("KM/H", screenWidth-120, screenHeight-150-2, _, _, tocolor(0, 0, 0, 200), 0.5, "bankgothic")
		dxDrawText("KM/H", screenWidth-120, screenHeight-150+2, _, _, tocolor(0, 0, 0, 200), 0.5, "bankgothic")
		dxDrawText("KM/H", screenWidth-120, screenHeight-150, _, _, tocolor(115, 177, 237, 200), 0.5, "bankgothic")

		dxDrawRectangle(screenWidth-230, screenHeight-70, 153, 1, tocolor(115, 177, 237))
		dxDrawRectangle(screenWidth-228, screenHeight-113, 3, 39, (bar >= 1 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-223, screenHeight-113, 3, 39, (bar >= 2 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-218, screenHeight-113, 3, 39, (bar >= 3 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-213, screenHeight-113, 3, 39, (bar >= 4 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-208, screenHeight-113, 3, 39, (bar >= 5 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-203, screenHeight-113, 3, 39, (bar >= 6 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-198, screenHeight-113, 3, 39, (bar >= 7 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-193, screenHeight-113, 3, 39, (bar >= 8 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-188, screenHeight-113, 3, 39, (bar >= 9 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-183, screenHeight-113, 3, 39, (bar >= 10 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-178, screenHeight-113, 3, 39, (bar >= 11 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-173, screenHeight-113, 3, 39, (bar >= 12 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-168, screenHeight-113, 3, 39, (bar >= 13 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-163, screenHeight-113, 3, 39, (bar >= 14 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-158, screenHeight-113, 3, 39, (bar >= 15 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-153, screenHeight-114, 3, 40, (bar >= 16 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-148, screenHeight-115, 3, 41, (bar >= 17 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-143, screenHeight-118, 3, 44, (bar >= 18 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-138, screenHeight-120, 3, 46, (bar >= 19 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-133, screenHeight-123, 3, 49, (bar >= 20 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-128, screenHeight-126, 3, 52, (bar >= 21 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-123, screenHeight-128, 3, 54, (bar >= 22 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-118, screenHeight-130, 3, 56, (bar >= 23 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-113, screenHeight-130, 3, 56, (bar >= 24 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-108, screenHeight-130, 3, 56, (bar >= 25 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-103, screenHeight-130, 3, 56, (bar >= 26 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-98, screenHeight-130, 3, 56, (bar >= 27 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-93, screenHeight-130, 3, 56, (bar >= 28 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-88, screenHeight-130, 3, 56, (bar >= 29 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
		dxDrawRectangle(screenWidth-83, screenHeight-130, 3, 56, (bar >= 30 and tocolor(115, 177, 237) or tocolor(0, 0, 0)))
	end
end)
2 emberek kedveli ezt

Megosztás


Megosztás link alapján
Megosztás egy közösségi oldalon

Regisztrálj vagy jelentkezz be, hogy válaszolhass

Csak felhasználóként kommentelhetsz.

Regisztrálj

Légy közösségünk tagja még ma! Csak fél perc.


Regisztrálok

Jelentkezz be

Már van felhasználód? Lépj be!


Bejelentkezek
Jelentkezz be, hogy követhesd  
Követő(k) 0