Sande Posted May 10, 2014 Share Posted May 10, 2014 Somereason i can only see the speedometer . If someone can give a solution how to fix that, then i am happy. function speedoCreate() if isPedInVehicle (localPlayer) == false then return end sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) local kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) local x, y, z = getElementPosition(localPlayer) vehicle = getVehicleName (getPedOccupiedVehicle(localPlayer)) health = getElementHealth (getPedOccupiedVehicle(localPlayer)) currenthealth = math.floor(health/10) dxDrawText("Speed: "..tostring(kmhs).."km/h", 1701, 956, 1924, 977, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top", false, false, true, false, false) dxDrawText("Health: "..tostring(currenthealth).."%", 1701, 987, 1924, 1008, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top", false, false, true, false, false) dxDrawRectangle(1700, 924, 191, 95, tocolor(0, 0, 0, 255), false) dxDrawRectangle(1701, 925, 189, 93, tocolor(27, 27, 27, 254), false) dxDrawText(""..tostring(vehicle).."", 1701, 925, 1855, 956, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top", false, false, true, false, false) end addEventHandler("onClientRender",getRootElement(),speedoCreate) function show ( player ) if ( player == localPlayer ) then addEventHandler ( "onClientRender", getRootElement(), speedoCreate ) end end addEventHandler ("onClientVehicleEnter", getRootElement(), show) function hide ( player ) if ( player == localPlayer ) then removeEventHandler ( "onClientRender", getRootElement(), speedoCreate ) end end addEventHandler ("onClientVehicleExit", getRootElement(), hide) Link to comment
Castillo Posted May 10, 2014 Share Posted May 10, 2014 What do you mean by "i can only see the speedometer"? Link to comment
Sande Posted May 10, 2014 Author Share Posted May 10, 2014 I mean, other players say they didn´t see it. But i see it. They taked screenshots. Link to comment
Castillo Posted May 10, 2014 Share Posted May 10, 2014 It could be that the speedometer is in the wrong position due to resolution differences. Link to comment
WASSIm. Posted May 10, 2014 Share Posted May 10, 2014 (edited) tell me what your resolution ! Edited May 10, 2014 by Guest Link to comment
Sande Posted May 10, 2014 Author Share Posted May 10, 2014 It could be that the speedometer is in the wrong position due to resolution differences. Oh theres a solution. Any idea how to make speedometer for all resolutions? @Wassim 1920 x 1080 Link to comment
justn Posted May 10, 2014 Share Posted May 10, 2014 Should work with all resolutions now function speedoCreate() if isPedInVehicle (localPlayer) == false then return end sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) local kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) local x, y, z = getElementPosition(localPlayer) local sH, sW = guiGetScreenSize() vehicle = getVehicleName (getPedOccupiedVehicle(localPlayer)) health = getElementHealth (getPedOccupiedVehicle(localPlayer)) currenthealth = math.floor(health/10) dxDrawText("Speed: "..tostring(kmhs).."km/h", sH*1701/1920, sW*956/1080, sH*1924/1920, sW*977/1080, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top", false, false, true, false, false) dxDrawText("Health: "..tostring(currenthealth).."%", sH*1701/1920, sW*987/1080, sH*1924/1920, sW*1008/1080, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top", false, false, true, false, false) dxDrawRectangle(sH*1700/1920, sW*924/1080, sH*191/1920, sW*95/1080, tocolor(0, 0, 0, 255), false) dxDrawRectangle(sH*1701/1920, sW*925/1080, sH*189/1920, sW*93/1080, tocolor(27, 27, 27, 254), false) dxDrawText(""..tostring(vehicle).."", sH*1701/1920, sW*925/1080, sH*1855/1920, sW*956/1080, tocolor(255, 255, 255, 255), 2.00, "default", "left", "top", false, false, true, false, false) end addEventHandler("onClientRender",getRootElement(),speedoCreate) function show ( player ) if ( player == localPlayer ) then addEventHandler ( "onClientRender", getRootElement(), speedoCreate ) end end addEventHandler ("onClientVehicleEnter", getRootElement(), show) function hide ( player ) if ( player == localPlayer ) then removeEventHandler ( "onClientRender", getRootElement(), speedoCreate ) end end addEventHandler ("onClientVehicleExit", getRootElement(), hide) Link to comment
Sande Posted May 10, 2014 Author Share Posted May 10, 2014 @Twerky thank you very very much! 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