papam77 Posted April 29, 2013 Share Posted April 29, 2013 Hello why i don't see my image in center ? Here is code ------------------------------------------------- -- Buttons ------------------------------------------------- addEventHandler("onClientResourceStart", resourceRoot, function() end ) function RelativeToAbsolute( X, Y ) rX, rY = guiGetScreenSize() local x = X*rX local y = Y*rY return x, y end addEventHandler("onClientRender",getRootElement(), function( ) local x,y = RelativeToAbsolute(0.00, -0.00) dxDrawImage(rX, rY,300,300,"img/dm.png", 0, 0, 0, tocolor(255, 255, 255, 255), "center", "center", true) end ) Link to comment
iPrestege Posted April 29, 2013 Share Posted April 29, 2013 You're relative position make no sense . You're code must be : local x,y = RelativeToAbsolute(xrelative ,yrelative ) dxDrawImage(x,y,rX,rY,"img/dm.png", 0, 0, 0, tocolor(255, 255, 255, 255), "center", "center", true) Link to comment
papam77 Posted April 30, 2013 Author Share Posted April 30, 2013 You're relative position make no sense .You're code must be : local x,y = RelativeToAbsolute(xrelative ,yrelative ) dxDrawImage(x,y,rX,rY,"img/dm.png", 0, 0, 0, tocolor(255, 255, 255, 255), "center", "center", true) GUIEditor = { button = {} } addEventHandler("onClientResourceStart", resourceRoot, function() end ) function RelativeToAbsolute( X, Y ) rX, rY = guiGetScreenSize() local x = X*rX local y = Y*rY return x, y end addEventHandler("onClientRender",getRootElement(), function( ) local x,y = RelativeToAbsolute(0.00, -0.00) GUIEditor.button[1] = guiCreateButton ( 0.50, 0.31, 0.25, 0.24, "","center","center", true ) addEventHandler("onClientGUIClick",GUIEditor.button[1],Click,false) alphaAmount = tonumber(255) guiSetAlpha ( GUIEditor.button[1], 255 ) end ) function Click( ) setElementData(localPlayer,"gamemode","race",true) outputChatBox( "* Data True !!",0,255,0 ) end Why i don't see button ? What's bad ? Link to comment
iPrestege Posted April 30, 2013 Share Posted April 30, 2013 GUIEditor = { button = {} } function RelativeToAbsolute( X, Y ) rX, rY = guiGetScreenSize() local x = X*rX local y = Y*rY return x, y end addEventHandler("onClientResourceStart", resourceRoot, function( ) -- You're code ... end ) addEventHandler("onClientRender",getRootElement(), function( ) local x,y = RelativeToAbsolute(0.00, -0.00) -- You're code ... end ) addEventHandler("onClientResourceStart", resourceRoot, function( ) GUIEditor.button[1] = guiCreateButton ( 0.50, 0.31, 0.25, 0.24,"",true ) addEventHandler("onClientGUIClick",GUIEditor.button[1],Click,false) guiSetAlpha ( GUIEditor.button[1], 1 ) end ) function Click( ) setElementData(localPlayer,"gamemode","race",true) outputChatBox( "* Data True !!",0,255,0 ) end Try it. Link to comment
denny199 Posted April 30, 2013 Share Posted April 30, 2013 guiSetAlphaRequired Arguments guiElement: the GUI element whose visibility is to be changed alpha: The visibility/transparency of the GUI element. Ranges from 0 (fully transparent) to 1 (fully opaque). And you was creating the button over and over in onClientRender.. Link to comment
papam77 Posted April 30, 2013 Author Share Posted April 30, 2013 GUIEditor = { button = {} } function RelativeToAbsolute( X, Y ) rX, rY = guiGetScreenSize() local x = X*rX local y = Y*rY return x, y end addEventHandler("onClientResourceStart", resourceRoot, function( ) -- You're code ... end ) addEventHandler("onClientRender",getRootElement(), function( ) local x,y = RelativeToAbsolute(0.00, -0.00) -- You're code ... end ) addEventHandler("onClientResourceStart", resourceRoot, function( ) GUIEditor.button[1] = guiCreateButton ( 0.50, 0.31, 0.25, 0.24,"",true ) addEventHandler("onClientGUIClick",GUIEditor.button[1],Click,false) guiSetAlpha ( GUIEditor.button[1], 1 ) end ) function Click( ) setElementData(localPlayer,"gamemode","race",true) outputChatBox( "* Data True !!",0,255,0 ) end Try it. Ty work it. addEventHandler("onClientResourceStart", "setElementData", resourceRoot, function() end ) function RelativeToAbsolute( X, Y ) rX, rY = guiGetScreenSize() local x = X*rX local y = Y*rY return x, y end addEventHandler("onClientRender",getRootElement(), function( ) local x,y = RelativeToAbsolute(0.00, -0.90) dxDrawText("Choose An Arena",x,y,rX, rY, tocolor(255, 255, 255, 255), 2.50, "bankgothic", "center", "center", false, false, true, false, false) end ) Scale is only for me i see it normal but my friend with 1024x768 see it too big Link to comment
iPrestege Posted April 30, 2013 Share Posted April 30, 2013 As i said before the relative position make no sense it's wrong and wrong and worng!@ 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