Sande Posted May 10, 2014 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)
Castillo Posted May 10, 2014 Posted May 10, 2014 What do you mean by "i can only see the speedometer"? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sande Posted May 10, 2014 Author Posted May 10, 2014 I mean, other players say they didn´t see it. But i see it. They taked screenshots.
Castillo Posted May 10, 2014 Posted May 10, 2014 It could be that the speedometer is in the wrong position due to resolution differences. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
WASSIm. Posted May 10, 2014 Posted May 10, 2014 (edited) tell me what your resolution ! Edited May 10, 2014 by Guest
Sande Posted May 10, 2014 Author 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
justn Posted May 10, 2014 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) Datastore - Store data to a database quickly. (Useful for saving scripted tables)
justn Posted May 10, 2014 Posted May 10, 2014 You're welcome. Datastore - Store data to a database quickly. (Useful for saving scripted tables)
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