T.P Posted March 28, 2014 Share Posted March 28, 2014 Hello everyone! a little help would be needed. there is a speedometer for me, but vainly rehearse to write the needle does not display it. Just line... function drawSpeedo() if active and not isPlayerMapVisible() then local vehicle = getPedOccupiedVehicle(getLocalPlayer()) if (vehicle) then speed = exports.global:getVehicleVelocity(vehicle) local width, height = guiGetScreenSize() local x = width local y = height -- street names local streetname = getElementData(getLocalPlayer(), "speedo:street" ) if streetname then local width = dxGetTextWidth( streetname ) local x = width < 200 and ( x - 110 - width / 2 ) or ( x - 10 - width ) dxDrawRectangle( x - 8, y - 296, width + 17, 24, tocolor( 5, 5, 5, 220 ) ) dxDrawText( streetname, x, y - 292 ) end dxDrawImage(x-210, y-275, 200, 200, "disc.png", 0, 0, 0, tocolor(255, 255, 255, 200), false) local speedlimit = getElementData(getLocalPlayer(), "speedo:limit") if speedlimit and getElementType(vehicle) ~= "Boat" and getElementType(vehicle) ~= "Helicopter" and getElementType(vehicle) ~= "Plane" then local ax, ay = x - 243, y - 202 dxDrawImage(ax,ay,32,37,"images/speed" .. speedlimit .. ".png") ay = ay - 32 if speedlimit >= 120 then dxDrawImage(ax,ay,32,37,"images/highway.png") ay = ay - 32 end if speed > speedlimit then dxDrawImage(ax,ay,32,37,"images/accident.png") end end speed = speed - 100 nx = x + math.sin(math.rad(-(speed)-150)) * 90 ny = y + math.cos(math.rad(-(speed)-150)) * 90 dxDrawLine(x-110, y-175, nx-110, ny-175, tocolor(255, 0, 0, 255), 2, true) end end end I know it...But is bad dxDrawImage(x-110, y-175, nx-110, ny-175, "needle.png"(255, 0, 0, 255), true) What should I exchange? Thanks a lot (sry my bad eng) Link to comment
WhoAmI Posted March 28, 2014 Share Posted March 28, 2014 Well, in this speedometer needle is dxDrawLine. Link to comment
T.P Posted March 28, 2014 Author Share Posted March 28, 2014 How I would be able to make it how let png display a picture? dxDrawImage(x-110, y-175, nx-110, ny-175, "needle.png"(255, 0, 0, 255), true) Its not work... Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now