Jump to content

[HELP]Bad Resolution


FuriouZ

Recommended Posts

Hey! I have problem,that if i play server in 800x600 resolution then all is fine.

but if i play 1366x768 then speedometer,clock and healthbar isn't in right place.

Help as fast as you can please ,thank you!

Code:

speedomeeter:

function speed ( ) 
    addEventHandler ( "onClientRender", root, getspeed ) 
end 
addEventHandler ("onClientVehicleEnter", root, speed) 
  
function wylacz ( ) 
  
    removeEventHandler ( "onClientRender", root, getspeed ) 
end 
addEventHandler("onClientVehicleExit", root, wylacz) 
  
    function hud ( ) 
        if isPedInVehicle (localPlayer) == false then return end 
        sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(localPlayer)) 
        kmhs = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180)  
        dxDrawText(""..tostring(kmhs).."",10,540,758,364.0,tocolor(255,255,255,255),0.9,Digital,"right","top",false,false,false)    
        dxDrawText ( "km/h",760,549,296.0,364.0,tocolor(255,255,255,255),1,"default-bold","left","top",false,false,false)             
    end 
addEventHandler("onClientRender",getRootElement(),hud) 

clock:

addEventHandler("onClientRender",root, 
    function() 
        local hours = getRealTime().hour 
        local minutes = getRealTime().minute 
   
dxDrawText(hours..":"..minutes,28,560,10,10,tocolor(255,255,255,255),0.5,Digital) 
    end 
) 
  

800x600px

mta-screen_2013-01-19_13-23-42.png

1366x768px

mta-screen_2013-01-19_13-22-25.png

Link to comment

All you have to do is calculate positions:

Clock:

28/800 = 0.035

560/600 = 0.933

10/800 = 0.0125

10/600 = 0.0166

  
local x, y = guiGetScreenSize() 
dxDrawText(hours..":"..minutes,x*0.035,y*0.933,x*0.0125,y*0.0166,tocolor(255,255,255,255),0.5,Digital) 
  

Do the same for others.

Link to comment
All you have to do is calculate positions:

Clock:

28/800 = 0.035

560/600 = 0.933

10/800 = 0.0125

10/600 = 0.0166

  
local x, y = guiGetScreenSize() 
dxDrawText(hours..":"..minutes,x*0.035,y*0.933,x*0.0125,y*0.0166,tocolor(255,255,255,255),0.5,Digital) 
  

Do the same for others.

Thank you wery much !! i got it working :P

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...