Xwad Posted November 28, 2015 Posted November 28, 2015 Hi i made a gui on my table computer. Its working but when i try the script on my laptop then the gui size will be different maybe becaouse the resolution of the laptops screen..Pls help how can i fix that problem? here is a part of my gui script. bg = guiCreateWindow(0, 0, 850, 850, "Spawn menu", false)
LabiVila Posted November 28, 2015 Posted November 28, 2015 This was explained like 10 times earlier, you better search previous topics, but however: local x,y = guiGetScreenSize () bg = guiCreateWindow(0, 0, 850*x/yourReslutionX, 850*x/yourResolutionY, "Spawn menu", false)
Xwad Posted November 28, 2015 Author Posted November 28, 2015 Thanks. One more question. Whats the default resolution in mta? just becaouse my set default is not working.
Xwad Posted November 29, 2015 Author Posted November 29, 2015 Its not working:/ attempt to perform arithmetic on global 'yourResolutionSizeX (a nil value)
1LoL1 Posted November 29, 2015 Posted November 29, 2015 Its not working:/attempt to perform arithmetic on global 'yourResolutionSizeX (a nil value) yourResolutionSizeX = Your resolution Settings --> Video --> Resolution: yourResolutionSizeY = Your resolution Settings --> Video --> Resolution:
Rockyz Posted November 29, 2015 Posted November 29, 2015 you can use this useful function source code function guiSetPos ( theGUI, x, y, Relative ) if ( ( isElement ( theGUI ) ) and ( getElementType ( theGUI ):find( "gui-" ) ) ) then if ( ( theGUI ) and ( x ) and ( y ) ) then local px, py = guiGetScreenSize ( ); local hx, hy = guiGetPosition ( theGUI, Relative ); guiSetPosition ( theGUI, hx * px / x, hy * py / y, Relative ); return true else return false end else return false end end syntax bool guiSetPos ( GUI theGUI, float x, float y, bool Relative ) example : GUIEditor = { button = {}, window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(396, 187, 377, 256, "Test", false) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 1.00) guiSetPos ( GUIEditor.window[1], 1366, 768, false ) guiSetVisible ( GUIEditor.window[1], false ) GUIEditor.button[1] = guiCreateButton(142, 73, 168, 41, "hi", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") end ) bindKey ( "F7", "down", function ( ) guiSetVisible ( GUIEditor.window[1], not guiGetVisible ( GUIEditor.window[1] ) ) showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) end ) function guiSetPos ( theGUI, x, y, Relative ) if ( ( isElement ( theGUI ) ) and ( getElementType ( theGUI ):find( "gui-" ) ) ) then if ( ( theGUI ) and ( x ) and ( y ) ) then local px, py = guiGetScreenSize ( ); local hx, hy = guiGetPosition ( theGUI, Relative ); guiSetPosition ( theGUI, hx * px / x, hy * py / y, Relative ); return true else return false end else return false end end
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