Jump to content

Simple0x47

Members
  • Posts

    1,518
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Simple0x47

  1. The dxDrawCircle function called with an updating angle would make the trick.
  2. Si deseas hacer un roleplay post-apocaliptico, te recomendaría desarrollar una normativa no muy estricta para permitir la diversión y la posiblidad de experimentar la supervivencia desde un punto de vista realista, no repleto de descripciones escritas a través del chat, para ello necesitaras tener una buena gamemode por lo tanto espero que puedas lograr algo y si necesitas ayuda con algo contactame por skype: killer.68x Ya que estoy interesado en desarrollar una gamemode de código abierto de supervivencia post-apocaliptica.
  3. It's not strange, it's normal. don't try to use values bigger than your height or width because that would make a full circle.
  4. There's no default events or functions that get done those kinds of things, so better make your own dxLib with different themes which could be stored into a table or XML and accessed when its needed to modify the active theme.
  5. MTA no está muriendo, vamos que ni de coña. Cada vez hay más jugadores, otra cosa que la inovación falte.
  6. Imaginate un circulo, y luego un cuadrado con bordes redondeados. Y ya esta. :v
  7. Hello everyone, nothing to say so. LUA: function dxDrawCircle( x, y, width, height, color, angleStart, angleSweep, borderWidth ) height = height or width color = color or tocolor(255,255,255) borderWidth = borderWidth or 1e9 angleStart = angleStart or 0 angleSweep = angleSweep or 360 - angleStart if ( angleSweep < 360 ) then angleEnd = math.fmod( angleStart + angleSweep, 360 ) + 0 else angleStart = 0 angleEnd = 360 end x = x - width / 2 y = y - height / 2 if not circleShader then circleShader = dxCreateShader ( "circle.fx" ) end dxSetShaderValue ( circleShader, "sCircleWidthInPixel", width ); dxSetShaderValue ( circleShader, "sCircleHeightInPixel", height ); dxSetShaderValue ( circleShader, "sBorderWidthInPixel", borderWidth ); dxSetShaderValue ( circleShader, "sAngleStart", math.rad( angleStart ) - math.pi ); dxSetShaderValue ( circleShader, "sAngleEnd", math.rad( angleEnd ) - math.pi ); dxDrawImage( x, y, width, height, circleShader, 0, 0, 0, color, true ) end function dxDrawRoundedRectangle( x, y, width, height, radius, color ) if ( radius >= width ) or ( radius >= height ) then dxDrawCircle( x - ( radius / 2 ), y - ( radius / 2 ) ) end -- The radius is relative to the height and width of the rectangle, so to avoid rectangles if the radius is bigger than the width or height then a complete circle is being drawn. dxDrawCircle( x + ( radius / 2 ), y + ( radius / 2 ), radius, radius, color, 270, 90 ) dxDrawCircle( x + ( radius / 2 ), ( y + height ) - ( radius / 2 ), radius, radius, color, 180, 90 ) dxDrawCircle( ( x + width ) - ( radius / 2 ), y + ( radius / 2 ), radius, radius, color, 0, 90 ) dxDrawCircle( ( x + width ) - ( radius / 2 ), ( y + height ) - ( radius / 2 ), radius, radius, color, 90, 90 ) dxDrawRectangle( x, y + ( radius / 2 ), width, ( height ) - ( radius ), color, true ) dxDrawRectangle( x + ( radius / 2 ), y , ( width ) - ( radius ), ( radius / 2 ), color, true ) dxDrawRectangle( x + ( radius / 2 ), ( y + height ) - ( radius / 2 ), ( width ) - ( radius ), ( radius / 2 ), color, true ) end CIRCLE.FX ( The one from the MTA Wiki ) float sCircleHeightInPixel = 100; float sCircleWidthInPixel = 100; float sBorderWidthInPixel = 10; float sAngleStart = -3.14; float sAngleEnd = 3.14; //------------------------------------------------------------------------------------------ // PixelShaderFunction // 1. Read from PS structure // 2. Process // 3. Return pixel color //------------------------------------------------------------------------------------------ float4 PixelShaderFunction(float4 Diffuse : COLOR0, float2 TexCoord : TEXCOORD0) : COLOR0 { float2 uv = float2( TexCoord.x, TexCoord.y ) - float2( 0.5, 0.5 ); // Clip unwanted pixels from partial pie float angle = atan2( -uv.x, uv.y ); // -PI to +PI if ( sAngleStart > sAngleEnd ) { if ( angle < sAngleStart && angle > sAngleEnd ) return 0; } else { if ( angle < sAngleStart || angle > sAngleEnd ) return 0; } // Calc border width to use float2 vec = normalize( uv ); float CircleRadiusInPixel = lerp( sCircleWidthInPixel, sCircleHeightInPixel, vec.y * vec.y ); float borderWidth = sBorderWidthInPixel / CircleRadiusInPixel; // Check if pixel is inside circle float dist = sqrt( dot( uv, uv ) ); if ( ( dist > 0.5 ) || ( dist < 0.5 - borderWidth ) ) return 0; else return Diffuse; } //------------------------------------------------------------------------------------------ // Techniques //------------------------------------------------------------------------------------------ technique tec0 { pass P0 { PixelShader = compile ps_2_0 PixelShaderFunction(); } }
  8. Buenas a todos, nada que decir así que dejo esto por aquí. LUA: function dxDrawCircle( x, y, width, height, color, angleStart, angleSweep, borderWidth ) height = height or width color = color or tocolor(255,255,255) borderWidth = borderWidth or 1e9 angleStart = angleStart or 0 angleSweep = angleSweep or 360 - angleStart if ( angleSweep < 360 ) then angleEnd = math.fmod( angleStart + angleSweep, 360 ) + 0 else angleStart = 0 angleEnd = 360 end x = x - width / 2 y = y - height / 2 if not circleShader then circleShader = dxCreateShader ( "circle.fx" ) end dxSetShaderValue ( circleShader, "sCircleWidthInPixel", width ); dxSetShaderValue ( circleShader, "sCircleHeightInPixel", height ); dxSetShaderValue ( circleShader, "sBorderWidthInPixel", borderWidth ); dxSetShaderValue ( circleShader, "sAngleStart", math.rad( angleStart ) - math.pi ); dxSetShaderValue ( circleShader, "sAngleEnd", math.rad( angleEnd ) - math.pi ); dxDrawImage( x, y, width, height, circleShader, 0, 0, 0, color, true ) end function dxDrawRoundedRectangle( x, y, width, height, radius, color ) if ( radius >= width ) or ( radius >= height ) then dxDrawCircle( x - ( radius / 2 ), y - ( radius / 2 ) ) end -- El radius es relativo al tamaño del rectángulo, para evitar 'bugs' se dibuja el circulo completo. dxDrawCircle( x + ( radius / 2 ), y + ( radius / 2 ), radius, radius, color, 270, 90 ) dxDrawCircle( x + ( radius / 2 ), ( y + height ) - ( radius / 2 ), radius, radius, color, 180, 90 ) dxDrawCircle( ( x + width ) - ( radius / 2 ), y + ( radius / 2 ), radius, radius, color, 0, 90 ) dxDrawCircle( ( x + width ) - ( radius / 2 ), ( y + height ) - ( radius / 2 ), radius, radius, color, 90, 90 ) dxDrawRectangle( x, y + ( radius / 2 ), width, ( height ) - ( radius ), color, true ) dxDrawRectangle( x + ( radius / 2 ), y , ( width ) - ( radius ), ( radius / 2 ), color, true ) dxDrawRectangle( x + ( radius / 2 ), ( y + height ) - ( radius / 2 ), ( width ) - ( radius ), ( radius / 2 ), color, true ) end CIRCLE.FX: float sCircleHeightInPixel = 100; float sCircleWidthInPixel = 100; float sBorderWidthInPixel = 10; float sAngleStart = -3.14; float sAngleEnd = 3.14; float4 PixelShaderFunction(float4 Diffuse : COLOR0, float2 TexCoord : TEXCOORD0) : COLOR0 { float2 uv = float2( TexCoord.x, TexCoord.y ) - float2( 0.5, 0.5 ); float angle = atan2( -uv.x, uv.y ); // -PI to +PI if ( sAngleStart > sAngleEnd ) { if ( angle < sAngleStart && angle > sAngleEnd ) return 0; } else { if ( angle < sAngleStart || angle > sAngleEnd ) return 0; } // Calc border width to use float2 vec = normalize( uv ); float CircleRadiusInPixel = lerp( sCircleWidthInPixel, sCircleHeightInPixel, vec.y * vec.y ); float borderWidth = sBorderWidthInPixel / CircleRadiusInPixel; // Check if pixel is inside circle float dist = sqrt( dot( uv, uv ) ); if ( ( dist > 0.5 ) || ( dist < 0.5 - borderWidth ) ) return 0; else return Diffuse; } technique tec0 { pass P0 { PixelShader = compile ps_2_0 PixelShaderFunction(); } } ( El shader publicado es uno de los shaders de ejemplo que hay en la wiki de MTA )
  9. You could use this. local total_km, partial_km, tick_km = 0, 0, 0 function handleSpeed() if ( getPedOccupiedVehicle( localPlayer ) and getVehicleOccupant( getPedOccupiedVehicle( localPlayer ), 0 ) == localPlayer ) then local theVehicle = getPedOccupiedVehicle( localPlayer ) if ( tick_km <= 0 ) and ( getVehicleEngineState( vehicle ) ) then tick_km = getTickCount() end if ( getTickCount() - tick_km >= 1000 ) then local sx, sy, sz = getElementVelocity ( theVehicle ) local kms = ( ( ( sx * sx ) + ( sy * sy ) + ( sz * sz ) ) ^ ( 0.5 ) ) * 1000 / 3600 -- This would be the most realistic way but it add's up very fastly so better up the number that is dividing. if ( partial_km + kms >= 1 ) then partial_km = ( partial_km + kms ) - 1 total_km = total_km + 1 else partial_km = partial_km + kms end tick_km = getTickCount() end end end addEventHandler( "onClientRender", root, handleSpeed )
  10. El GUIEDITOR de por si ya trae esta función que es igual vamos... Pero igual, gracias por aportar tus conocimientos a la comunidad.
  11. Try this: (WXYZ) ( 0.5213, -0.47775, 0.70385, -0.06779 )
  12. These are rotation angles, make sure the rotation order is "ZYX" and not "ZXY" because the second one is the default for objects, but the one that the converters use is the first one "ZYX".
  13. Simple0x47

    VIP panel

    function showPanel(thePlayer) accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then local account = getPlayerAccount( thePlayer ) local tick = getAccountData( account, "panel_tick" ) or 0 if ( ( getTickCount() - tick ) >= 7200000 ) then setAccountData( account, "panel_tick", getTickCount() ) triggerClientEvent(thePlayer, "abrirVip", getRootElement()) end end end Replace your showPanel function with this one and done.
  14. Just search in google for quaternion euler converter online. Theres a simple website which allows you to make the conversion. And there q1 is the W and then q2 X etc.
  15. Simple0x47

    GTA 5 MTA

    MTA Team said that they're not going to make stuff in the benefit of Rockstar Games anymore. So don't expect any other MTA release for other games of Rockstar Games.
  16. Lo mejor sería invertir en un videojuego. Hay que mejorar
  17. It could be pretty useful just to avoid the resources consumption with a virtual machine, but the main problem is that GTA SA doesn't allow there to be another process of GTA SA to be executed. If that could change, it would be easy to make the rest.
  18. Possible doesn't mean optimized and efficient.
  19. Could you use another font color? And try to explain better, at least use Google Traductor cuz what I've read is that you want a Gun Game mode.
  20. Versión adaptable: local screenWidth, screenHeight = guiGetScreenSize( ) width = 400 / 1336 height = 420 / 768 function ctrl_dx() dxDrawRectangle( (screenWidth - ( width * screenWidth ) ) / 2, (screenWidth - ( height * screenHeight ) ) / 2, width * screenWidth, height * screenHeight, tocolor(57, 57, 57, 255), false) dxDrawRectangle( (screenWidth - ( width * screenWidth ) ) / 2, (screenWidth - ( height * screenHeight ) ) / 2, width * screenWidth, height * screenHeight, tocolor(254, 254, 254, 255), false) end addEventHandler("onClientRender", root, ctrl_dx)
  21. For the best results a custom MTA build should be done with the FLA. But that's not gonna happen so we can just use the engine functions with the ID limits.
  22. There's people that makes GM from scratch, but just if it worths it. None experienced scripter would waste his time on low payments.
  23. Has intentado uniendo el string del query con el simbolo ? ( query .. "?" ) y podrias tambien intentar dar valor ? A ?
×
×
  • Create New...