bandi94 Posted November 5, 2011 Share Posted November 5, 2011 Whit Dx the best is to check the client screen size and then if zise .....=1280x720 then post x,y,z=...... elseif .... or use guiLabel and use bool relative as true and then its automaticaly sized and moved Link to comment
arezu Posted November 5, 2011 Share Posted November 5, 2011 I've created the DX text in GUIEditor, but I want to the text adjust to all resolutions. The text appear in same location but adjusted to the resolution to be visible to the player. If resolution is 800 x 600 the text appear under the HUD but adjusted to resolution, if resolution is, ex: 1280 x 720 - Adjust the text to the screen size but in the same location. Understand ? Thats how the script i wrote to you is working.. or is it not? Link to comment
Jaysds1 Posted November 5, 2011 Share Posted November 5, 2011 I know this script is going to be hard but the best way is to get the screen size and make if...elseif statements, but between all those, you have to change the size Link to comment
TAPL Posted November 5, 2011 Share Posted November 5, 2011 could you take a shot screen to see where is the dx on the screen? Edit: try this should work 99.9% function AbsoluteToRelativ2( X, Y ) local rX, rY = guiGetScreenSize() local x = math.floor(X*rX/1280) local y = math.floor(Y*rY/720) return x, y end function DXdraw() local x1, y1 = AbsoluteToRelativ2( 959,246 ) local x2, y2 = AbsoluteToRelativ2( 956,243 ) dxDrawText("textQuit", x1, y1, 1224, 264, tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText("textQuit", x2, y2, 1224, 261, tocolor(255,0,0,255),0.6,"bankgothic","left","top",false,false,false) end addEventHandler("onClientRender", root, DXdraw) Link to comment
drk Posted November 6, 2011 Author Share Posted November 6, 2011 I've created the DX text in GUIEditor, but I want to the text adjust to all resolutions. The text appear in same location but adjusted to the resolution to be visible to the player. If resolution is 800 x 600 the text appear under the HUD but adjusted to resolution, if resolution is, ex: 1280 x 720 - Adjust the text to the screen size but in the same location. Understand ? Thats how the script i wrote to you is working.. or is it not? Is working but isn't what I want, but thanks for try helping me. Link to comment
drk Posted November 6, 2011 Author Share Posted November 6, 2011 could you take a shot screen to see where is the dx on the screen?Edit: try this should work 99.9% function AbsoluteToRelativ2( X, Y ) local rX, rY = guiGetScreenSize() local x = math.floor(X*rX/1280) local y = math.floor(Y*rY/720) return x, y end function DXdraw() local x1, y1 = AbsoluteToRelativ2( 959,246 ) local x2, y2 = AbsoluteToRelativ2( 956,243 ) dxDrawText("textQuit", x1, y1, 1224, 264, tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText("textQuit", x2, y2, 1224, 261, tocolor(255,0,0,255),0.6,"bankgothic","left","top",false,false,false) end addEventHandler("onClientRender", root, DXdraw) Ok, I will try. And sorry for what I said in another post. When I'm nervous I talk nonsense. Link to comment
drk Posted November 6, 2011 Author Share Posted November 6, 2011 Don't worked, I tried this and this: function AbsoluteToRelativ2( X, Y ) local rX, rY = guiGetScreenSize() if ( rX == 1280 ) and ( rY == 720 ) then local x = math.floor(X*rX/1280) local y = math.floor(Y*rY/720) return x, y end if ( rX == 1280 ) and ( rY == 600 ) then local x = math.floor(X*rX/1280) local y = math.floor(Y*rY/600) return x, y end if ( rX == 800 ) and ( rY == 600 ) then local x = math.floor(X*rX/800) local y = math.floor(Y*rY/600) return x, y end if ( rX == 640 ) and ( rY == 480 ) then local x = math.floor(X*rX/640) local y = math.floor(Y*rY/480) return x, y end end addEventHandler ( "onClientRender", root, local x1, y1 = AbsoluteToRelativ2( 959,246 ) local x2, y2 = AbsoluteToRelativ2( 956,243 ) local x3, y3 = AbsoluteToRelativ2( 943,217 ) local x4, y4 = AbsoluteToRelativ2( 939,213 ) dxDrawText( textQuit, x1, y1, 1224, 264, tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( textQuit, x2, y2, 1224, 261, tocolor(255,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( textJoin, x3, y3, 1211.0, 235.0,tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( textJoin, x4, y4, 1207.0,231.0,tocolor(0,255,0,255),0.6,"bankgothic","left","top",false,false,false) end ) And don't work. Please anyone help. Link to comment
TAPL Posted November 6, 2011 Share Posted November 6, 2011 what is doesn't work? i tested this and working with all resolution i don't understand what is not work can you put an image? function AbsoluteToRelativ2( X, Y ) local rX, rY = guiGetScreenSize() local x = math.floor(X*rX/1280) local y = math.floor(Y*rY/720) return x, y end function DXdraw() local x1, y1 = AbsoluteToRelativ2( 959,246 ) local x2, y2 = AbsoluteToRelativ2( 956,243 ) dxDrawText("textQuit", x1, y1, 1224, 264, tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText("textQuit", x2, y2, 1224, 261, tocolor(255,0,0,255),0.6,"bankgothic","left","top",false,false,false) end addEventHandler("onClientRender", root, DXdraw) Link to comment
drk Posted November 6, 2011 Author Share Posted November 6, 2011 When a player join or quit the server don't appear anything. Link to comment
TAPL Posted November 6, 2011 Share Posted November 6, 2011 you want the player name showing in the screen when he is join - quit? ok where is your script? the server won't appear anything by his self -_-"" what i post was just adjust to all resolutions Link to comment
drk Posted November 6, 2011 Author Share Posted November 6, 2011 No, i've do this, when a player enter don't appear the DX text in the screen with your coordenates. Link to comment
drk Posted November 7, 2011 Author Share Posted November 7, 2011 function AbsoluteToRelativ2( X, Y ) local rX, rY = guiGetScreenSize() local x = math.floor(X*rX/1280) local y = math.floor(Y*rY/720) return x, y end addEventHandler ( "onClientRender", root, local x1, y1 = AbsoluteToRelativ2( 959,246 ) local x2, y2 = AbsoluteToRelativ2( 956,243 ) local x3, y3 = AbsoluteToRelativ2( 943,217 ) local x4, y4 = AbsoluteToRelativ2( 939,213 ) dxDrawText( textQuit, x1, y1, 1224, 264, tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( textQuit, x2, y2, 1224, 261, tocolor(255,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( textJoin, x3, y3, 1211.0, 235.0,tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( textJoin, x4, y4, 1207.0,231.0,tocolor(0,255,0,255),0.6,"bankgothic","left","top",false,false,false) end ) I tried this too: function AbsoluteToRelativ2( X, Y ) local rX, rY = guiGetScreenSize() if ( rX == 1280 ) and ( rY == 720 ) then local x = math.floor(X*rX/1280) local y = math.floor(Y*rY/720) return x, y end if ( rX == 1280 ) and ( rY == 600 ) then local x = math.floor(X*rX/1280) local y = math.floor(Y*rY/600) return x, y end if ( rX == 800 ) and ( rY == 600 ) then local x = math.floor(X*rX/800) local y = math.floor(Y*rY/600) return x, y end if ( rX == 640 ) and ( rY == 480 ) then local x = math.floor(X*rX/640) local y = math.floor(Y*rY/480) return x, y end end addEventHandler ( "onClientRender", root, local x1, y1 = AbsoluteToRelativ2( 959,246 ) local x2, y2 = AbsoluteToRelativ2( 956,243 ) local x3, y3 = AbsoluteToRelativ2( 943,217 ) local x4, y4 = AbsoluteToRelativ2( 939,213 ) dxDrawText( textQuit, x1, y1, 1224, 264, tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( textQuit, x2, y2, 1224, 261, tocolor(255,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( textJoin, x3, y3, 1211.0, 235.0,tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( textJoin, x4, y4, 1207.0,231.0,tocolor(0,255,0,255),0.6,"bankgothic","left","top",false,false,false) end ) But don't work. And don't have any error, I uused /debugscript 3 Link to comment
TAPL Posted November 7, 2011 Share Posted November 7, 2011 i don't see any event onPlayerJoin or onPlayerQuit -_-" Link to comment
drk Posted November 7, 2011 Author Share Posted November 7, 2011 You think that I'm going to put the entire code here? - ' Link to comment
arezu Posted November 7, 2011 Share Posted November 7, 2011 You forgot function() here: addEventHandler ( "onClientRender", root, local x1, y1 = AbsoluteToRelativ2( 959,246 ) local x2, y2 = AbsoluteToRelativ2( 956,243 ) local x3, y3 = AbsoluteToRelativ2( 943,217 ) local x4, y4 = AbsoluteToRelativ2( 939,213 ) dxDrawText( "textQuit", x1, y1, 1224, 264, tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( "textQuit", x2, y2, 1224, 261, tocolor(255,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( "textJoin", x3, y3, 1211.0, 235.0,tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( "textJoin", x4, y4, 1207.0,231.0,tocolor(0,255,0,255),0.6,"bankgothic","left","top",false,false,false) end) so write function() after root, .. like this: addEventHandler ( "onClientRender", root, function() local x1, y1 = AbsoluteToRelativ2( 959,246 ) local x2, y2 = AbsoluteToRelativ2( 956,243 ) local x3, y3 = AbsoluteToRelativ2( 943,217 ) local x4, y4 = AbsoluteToRelativ2( 939,213 ) dxDrawText( "textQuit", x1, y1, 1224, 264, tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( "textQuit", x2, y2, 1224, 261, tocolor(255,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( "textJoin", x3, y3, 1211.0, 235.0,tocolor(0,0,0,255),0.6,"bankgothic","left","top",false,false,false) dxDrawText( "textJoin", x4, y4, 1207.0,231.0,tocolor(0,255,0,255),0.6,"bankgothic","left","top",false,false,false) end) 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