xxxDrez Posted July 14, 2019 Share Posted July 14, 2019 Hi, i have source code my menu, how create function at select menu, for example the when will player select at menu, after selection, the function starts. and how to be able to do to let select with mouse or buttons ? sorry for my English, I'm Russian My code: local renderTarget = dxCreateRenderTarget( 1000, 1000, true ) local posX, posY, posZ = 14, 0, 2.8 local scroll = 0 local players = { } table.insert( players, { "Лицо" } ) table.insert( players, { "Волосы" } ) table.insert( players, { "Кожа" } ) table.insert( players, { "Одежда" } ) table.insert( players, { "Руки" } ) table.insert( players, { "Ноги" } ) table.insert( players, { "Голова" } ) table.insert( players, { "Лоб" } ) table.insert( players, { "лицо" } ) table.insert( players, { "голова" } ) table.insert( players, { "руки" } ) table.insert( players, { "одежда" } ) table.insert( players, { "пальцы" } ) table.insert( players, { "Лицо" } ) table.insert( players, { "Лицо" } ) function rendermenu() dxSetRenderTarget( renderTarget, true ) local offsetY = 100 for i = 1, #players do local posX, posY, width, height = 0, offsetY - scroll, 970, 80 dxDrawRectangle( posX, posY, width, height, tocolor( 0, 0, 0, 200 ) ) dxDrawText( players[ i ][ 1 ], posX + 30, posY, posX + 30 + width, posY + height, tocolor( 255, 255, 255, 255 ), 3, "default-bold", "left", "center" ) --dxDrawText( players[ i ][ 2 ], posX + ( width - 30 ), posY, posX + ( width - 30 ), posY + height, tocolor( 255, 255, 255, 255 ), 3, "default-bold", "right", "center" ) offsetY = offsetY + 80 end local contentH = #players * 80 local viewableRatio = 900 / contentH local scrollH = 900 * viewableRatio dxDrawRectangle( 970, 100, 30, 900, tocolor( 0, 0, 0, 230 ) ) dxDrawRectangle( 970, 100 + ( scroll * viewableRatio ), 30, scrollH, tocolor( 255, 255, 255, 230 ) ) dxDrawRectangle( 0, 0, 1000, 100, tocolor( 0, 0, 0, 255 ) ) dxDrawText( " Создание персонажа ", 0, 0, 1000, 100, tocolor( 255, 255, 255, 255 ), 5, "default-bold", "center", "center" ) if ( getKeyState( "f4" ) ) then dxSetRenderTarget( myRenderTarget ) end if ( getKeyState( "f2" ) ) then scroll = math.min( scroll + 15, contentH - 900 ) elseif ( getKeyState( "f3" ) ) then scroll = math.max( scroll - 15, 0 ) end dxSetRenderTarget( ) dxDrawMaterialLine3D( posX, posY, posZ + 5, posX, posY, posZ, renderTarget, 5, tocolor( 255, 255, 255, 255 ), 0, 0, 0 ) end addEventHandler( "onClientRender", root,rendermenu) Link to comment
Dimos7 Posted July 14, 2019 Share Posted July 14, 2019 https://forum.multitheftauto.com/forum/100-russian-русский/ post here to native language to help you Link to comment
xxxDrez Posted July 14, 2019 Author Share Posted July 14, 2019 There very low online, therefore, there is not help. So I write here Link to comment
iMr.WiFi..! Posted July 15, 2019 Share Posted July 15, 2019 local renderTarget = dxCreateRenderTarget( 1000, 1000, true ) local posX, posY, posZ = 14, 0, 2.8 local scroll = 0 local players = { } table.insert( players, { "Лицо" } ) table.insert( players, { "Волосы" } ) table.insert( players, { "Кожа" } ) table.insert( players, { "Одежда" } ) table.insert( players, { "Руки" } ) table.insert( players, { "Ноги" } ) table.insert( players, { "Голова" } ) table.insert( players, { "Лоб" } ) table.insert( players, { "лицо" } ) table.insert( players, { "голова" } ) table.insert( players, { "руки" } ) table.insert( players, { "одежда" } ) table.insert( players, { "пальцы" } ) table.insert( players, { "Лицо" } ) table.insert( players, { "Лицо" } ) function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end function rendermenu() dxSetRenderTarget( renderTarget, true ) local offsetY = 100 for i = 1, #players do local posX, posY, width, height = 0, offsetY - scroll, 970, 80 dxDrawRectangle( posX, posY, width, height, tocolor( 0, 0, 0, 200 ) ) dxDrawText( players[ i ][ 1 ], posX + 30, posY, posX + 30 + width, posY + height, tocolor( 255, 255, 255, 255 ), 3, "default-bold", "left", "center" ) --dxDrawText( players[ i ][ 2 ], posX + ( width - 30 ), posY, posX + ( width - 30 ), posY + height, tocolor( 255, 255, 255, 255 ), 3, "default-bold", "right", "center" ) if( isMouseInPosition( posX, posY, width, height ) )then if( getKeyState("mouse1") )then -- Your function here. end end offsetY = offsetY + 80 end local contentH = #players * 80 local viewableRatio = 900 / contentH local scrollH = 900 * viewableRatio dxDrawRectangle( 970, 100, 30, 900, tocolor( 0, 0, 0, 230 ) ) dxDrawRectangle( 970, 100 + ( scroll * viewableRatio ), 30, scrollH, tocolor( 255, 255, 255, 230 ) ) dxDrawRectangle( 0, 0, 1000, 100, tocolor( 0, 0, 0, 255 ) ) dxDrawText( " Создание персонажа ", 0, 0, 1000, 100, tocolor( 255, 255, 255, 255 ), 5, "default-bold", "center", "center" ) if ( getKeyState( "f4" ) ) then dxSetRenderTarget( myRenderTarget ) end if ( getKeyState( "f2" ) ) then scroll = math.min( scroll + 15, contentH - 900 ) elseif ( getKeyState( "f3" ) ) then scroll = math.max( scroll - 15, 0 ) end dxSetRenderTarget( ) dxDrawMaterialLine3D( posX, posY, posZ + 5, posX, posY, posZ, renderTarget, 5, tocolor( 255, 255, 255, 255 ), 0, 0, 0 ) end addEventHandler( "onClientRender", root,rendermenu) 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