FuriouZ Posted January 19, 2013 Posted January 19, 2013 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 1366x768px Homepage @ http://rageresources.blogspot.com/ Offical Facebook @ https://www.facebook.com/pages/Rage-Scr ... fref=photo
GTX Posted January 19, 2013 Posted January 19, 2013 guiGetScreenSize -- Check out: Using guiGetScreenSize to fit GUI & DX drawing in all resolutions Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
FuriouZ Posted January 19, 2013 Author Posted January 19, 2013 guiGetScreenSize -- Check out: Using guiGetScreenSize to fit GUI & DX drawing in all resolutions Explain more please I'm not very good scripter,just started it Homepage @ http://rageresources.blogspot.com/ Offical Facebook @ https://www.facebook.com/pages/Rage-Scr ... fref=photo
GTX Posted January 19, 2013 Posted January 19, 2013 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. Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
FuriouZ Posted January 19, 2013 Author Posted January 19, 2013 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 Homepage @ http://rageresources.blogspot.com/ Offical Facebook @ https://www.facebook.com/pages/Rage-Scr ... fref=photo
GTX Posted January 19, 2013 Posted January 19, 2013 You're welcome! Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
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