DBY Posted April 21, 2017 Share Posted April 21, 2017 Estaba aburrido y llevaba bastante tiempo sin scriptear así que me puse a buscar por la wiki funciones que nunca usé y encontré dxDrawMaterialLine3D. Aquí os dejo un vídeo y el código de un scoreboard simple que he hecho para probar la función, por si os es útil el tema del scroll y lo que podáis encontrar. Código Client-Side: Spoiler local renderTarget = dxCreateRenderTarget( 1000, 1000, true ) local posX, posY, posZ = 14, 0, 2.8 local scroll = 0 local players = { } for i = 1, math.random( 15, 36 ) do table.insert( players, { "Row #" .. #players, math.random( 50, 180 ) } ) end addEventHandler( "onClientRender", root, function( ) 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( "3D Scoreboard " .. #players .. "/100", 0, 0, 1000, 100, tocolor( 255, 255, 255, 255 ), 5, "default-bold", "center", "center" ) if ( getKeyState( "pgdn" ) ) then scroll = math.min( scroll + 15, contentH - 900 ) elseif ( getKeyState( "pgup" ) ) then scroll = math.max( scroll - 15, 0 ) end dxSetRenderTarget( ) dxDrawMaterialLine3D( posX, posY, posZ + 5, posX, posY, posZ, renderTarget, 5, tocolor( 255, 255, 255, 255 ), true ) end ) 2 Link to comment
Simple0x47 Posted April 21, 2017 Share Posted April 21, 2017 Muy buen aporte, este aporte nos muestra que mediante el aprendizaje uno puede compartir los conocimientos adquiridos a los demás de forma gratuita sin solicitar nada a cambio. Respeto. 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