Jump to content

Velocimetro


Recommended Posts

--Client

function speedometrs ()
local veh = getPedOccupiedVehicle(getLocalPlayer()) 
if not veh or getVehicleOccupant ( veh , 0 ) ~= localPlayer then return true end
	local Speed = getVehicleSpeed()
	local car = getPedOccupiedVehicle(localPlayer)
	local vehs = getElementSpeed(getPedOccupiedVehicle(getLocalPlayer()), "kmh")
	local nitro = getVehicleNitroLevel(car) or 0
	local Count = getVehicleNitroCount(car) or 0 
	local fuel = getElementData(getPedOccupiedVehicle ( localPlayer ), "fuel" ) or 0

	if Speed > 243 then
		Speed = 243
	end
	if Speed < -243 then
		Speed = -243
	end
	
	if Count >= 1 then
		nos = (math.floor(nitro/1*10))
	else
		nos = 0
	end
	   
	dxDrawImage(SizeX - 250,SizeY - 250, 230, 230, "img/panel.png", 0,0,0 )
	dxDrawImage(SizeX - 390,SizeY - 250, 230, 230, "img/benz.png", 0,0,0 )
	dxDrawImage(SizeX - 447,SizeY - 220, 170, 170, "img/nospan.png", 0,0,0 )
	
	dxDrawImage(SizeX - 250,SizeY - 250, 230, 230, "img/arrow.png", Speed,0,0 )
	
	dxDrawImage(SizeX - 370,SizeY - 250, 230, 230, "img/arrow_nitro_benz.png", fuel * 3.12,0,0 )
	dxDrawImage(SizeX - 430,SizeY - 220, 170, 170, "img/arrow_nitro_benz.png", nitro/1*155,0,0 )
	
	dxDrawImage(SizeX - 143,SizeY - 57, 20, 19, lignths, 0,0,0 )
	
	dxDrawImage(SizeX - 198,SizeY - 73, 20, 19, l_p, 0,0,0 )
	
	
	dxDrawImage(SizeX - 90,SizeY - 73, 20, 19, p_p, 0,0,0 )
	
	dxDrawText(""..nos.." Nit. ".. Count .." Nos.",SizeX,SizeY - 130, SizeX - 315,SizeY, tocolor(255,255,255,255), 0.4,0.4, font,"right","center")
	dxDrawText(tostring ( getFormatSpeed ( vehs )),SizeX,SizeY - 265, SizeX - 110,SizeY, tocolor(255,255,255,255), 0.8,0.8, font,"right","center")
	dxDrawText(tostring (math.round  (fuel)).." Gas.",SizeX,SizeY - 145, SizeX - 240,SizeY, tocolor(255,255,255,255), 0.4,0.4, font,"right","center")
end
addEventHandler("onClientRender", root, speedometrs)

O velocímetro só aparece para quem está no assento do motorista, caso eu altere para 1, somente quem estiver no assento 1 conseguirá ver. O que eu posso utilizar para que todos dentro do veiculo possam ver o velocímetro?

Link to comment
  • Other Languages Moderators
function speedometrs ()
	local veh = getPedOccupiedVehicle(getLocalPlayer()) 
	if veh then
		local Speed = getVehicleSpeed()
    	...
    	...

 

Edited by Lord Henry
  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...