Turbe$Z Posted March 11, 2017 Share Posted March 11, 2017 (edited) In 1440x900 resolution, the dx elements they are in the right place, but in 1920x1080 the dx elements move up, and in 1366x768 the dx elements move down.. Why? how to fix this? the guigetscreensize is added with the correct coordinates.. Edited March 11, 2017 by Turbo777 Link to comment
Ayush Rathore Posted March 11, 2017 Share Posted March 11, 2017 By making them relative like local sx,sy = guiGetScreenSize() posX,posY = sx*0.1,sy*0.1 posX,posY will be same for all resolution relative starts from 0.0 to 1.0 Link to comment
Turbe$Z Posted March 11, 2017 Author Share Posted March 11, 2017 32 minutes ago, Ayush Rathore said: By making them relative like local sx,sy = guiGetScreenSize() posX,posY = sx*0.1,sy*0.1 posX,posY will be same for all resolution relative starts from 0.0 to 1.0 same problem Link to comment
Ayush Rathore Posted March 11, 2017 Share Posted March 11, 2017 Just now, Turbo777 said: same problem post your code Link to comment
Turbe$Z Posted March 11, 2017 Author Share Posted March 11, 2017 Just now, Ayush Rathore said: post your code i downloaded a fps and ping meter from community, and i want change the position local ping = getPlayerPing(getLocalPlayer()) local x, y = guiGetScreenSize ( ) local posx2,posy2 = x*0.1,y*0.1 local root = getRootElement() local player = getLocalPlayer() local counter = 0 local starttick local currenttick addEventHandler("onClientRender",root, function() if not starttick then starttick = getTickCount() end counter = counter + 1 currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"FPS",counter) counter = 0 starttick = false end end ) function drawStates () addEventHandler ( "onClientRender", root, pingState ) addEventHandler ( "onClientRender", root, fpsState ) end addEventHandler ( "onClientResourceStart", resourceRoot, drawStates ) function fpsState() local ping = getPlayerPing(getLocalPlayer()) posx2= x-55 posy2= 13 dxDrawText ( getElementData(getLocalPlayer(),"FPS"), posx2-118, posy2+18, x, y, tocolor ( 30, 144, 255, 255 ), 1.0, "default-bold" ) dxDrawText ( ping.." ms", posx2-23, posy2+18, x, y, tocolor ( 30, 144, 255, 255 ), 1.0, "default-bold" ) dxDrawText ( "FPS", posx2-120, posy2+33, x, y, tocolor ( 30, 144, 255, 255 ), 0.8, "default-bold" ) dxDrawText ( "PING", posx2-20, posy2+33, x, y, tocolor ( 30, 144, 255, 255 ), 0.8, "default-bold" ) end fileDelete("client.lua") Link to comment
Ayush Rathore Posted March 11, 2017 Share Posted March 11, 2017 where you want your fps and ping 1 minute ago, Turbo777 said: i downloaded a fps and ping meter from community, and i want change the position local ping = getPlayerPing(getLocalPlayer()) local x, y = guiGetScreenSize ( ) local posx2,posy2 = x*0.1,y*0.1 local root = getRootElement() local player = getLocalPlayer() local counter = 0 local starttick local currenttick addEventHandler("onClientRender",root, function() if not starttick then starttick = getTickCount() end counter = counter + 1 currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"FPS",counter) counter = 0 starttick = false end end ) function drawStates () addEventHandler ( "onClientRender", root, pingState ) addEventHandler ( "onClientRender", root, fpsState ) end addEventHandler ( "onClientResourceStart", resourceRoot, drawStates ) function fpsState() local ping = getPlayerPing(getLocalPlayer()) posx2= x-55 posy2= 13 dxDrawText ( getElementData(getLocalPlayer(),"FPS"), posx2-118, posy2+18, x, y, tocolor ( 30, 144, 255, 255 ), 1.0, "default-bold" ) dxDrawText ( ping.." ms", posx2-23, posy2+18, x, y, tocolor ( 30, 144, 255, 255 ), 1.0, "default-bold" ) dxDrawText ( "FPS", posx2-120, posy2+33, x, y, tocolor ( 30, 144, 255, 255 ), 0.8, "default-bold" ) dxDrawText ( "PING", posx2-20, posy2+33, x, y, tocolor ( 30, 144, 255, 255 ), 0.8, "default-bold" ) end fileDelete("client.lua") Link to comment
Turbe$Z Posted March 11, 2017 Author Share Posted March 11, 2017 4 minutes ago, Ayush Rathore said: where you want your fps and ping http://imgur.com/a/9BVAn Link to comment
Ayush Rathore Posted March 11, 2017 Share Posted March 11, 2017 after seeing your code it should be this local ping = getPlayerPing(getLocalPlayer()) local x, y = guiGetScreenSize ( ) local posA,posB = x*0.95,y*0.03 local posC,posD = x*0.87,y*0.03 local root = getRootElement() local player = getLocalPlayer() local counter = 0 local starttick local currenttick addEventHandler("onClientRender",root, function() if not starttick then starttick = getTickCount() end counter = counter + 1 currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"FPS",counter) counter = 0 starttick = false end end ) function drawStates () addEventHandler ( "onClientRender", root, pingState ) addEventHandler ( "onClientRender", root, fpsState ) end addEventHandler ( "onClientResourceStart", resourceRoot, drawStates ) function fpsState() local ping = getPlayerPing(getLocalPlayer()) dxDrawText ( "FPS:"..getElementData(getLocalPlayer(),"FPS"), posA, posB, x, y, tocolor ( 30, 144, 255, 255 ), 1.0, "default-bold" ) dxDrawText ( "PING:"..ping.." ms", posC, posD, x, y, tocolor ( 30, 144, 255, 255 ), 1.0, "default-bold" ) end fileDelete("client.lua") it will fit all res think sx*0.1 as 1/10 of sx and sy*0.1 as 1/10 of sy so sy*0.2 will be 2/10 of sy for example if sx = 1366 and sy =768 then sx*0.1 = 136.6 sx*0.2 = (136.6*2) well i am not good at making people understand but few example above can click your brain on how i did it 1 Link to comment
Turbe$Z Posted March 11, 2017 Author Share Posted March 11, 2017 8 minutes ago, Ayush Rathore said: after seeing your code it should be this local ping = getPlayerPing(getLocalPlayer())local x, y = guiGetScreenSize ( )local posA,posB = x*0.95,y*0.03local posC,posD = x*0.87,y*0.03local root = getRootElement()local player = getLocalPlayer()local counter = 0local startticklocal currenttickaddEventHandler("onClientRender",root, function() if not starttick then starttick = getTickCount() end counter = counter + 1 currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"FPS",counter) counter = 0 starttick = false end end)function drawStates () addEventHandler ( "onClientRender", root, pingState ) addEventHandler ( "onClientRender", root, fpsState )endaddEventHandler ( "onClientResourceStart", resourceRoot, drawStates )function fpsState() local ping = getPlayerPing(getLocalPlayer()) dxDrawText ( "FPS:"..getElementData(getLocalPlayer(),"FPS"), posA, posB, x, y, tocolor ( 30, 144, 255, 255 ), 1.0, "default-bold" ) dxDrawText ( "PING:"..ping.." ms", posC, posD, x, y, tocolor ( 30, 144, 255, 255 ), 1.0, "default-bold" )endfileDelete("client.lua") it will fit all res thanks Link to comment
Ayush Rathore Posted March 11, 2017 Share Posted March 11, 2017 your welcome 3 minutes ago, Turbo777 said: thanks 1 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