Jump to content

XaskeL

Members
  • Posts

    246
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by XaskeL

  1. Hi! You don't need to scale the interface size for monitors larger than the one on which the layout was printed and designed. It's enough just to put everything in the center, some elements really need to be stretched to the whole screen (like the background). But this is rather an exception to the rule.

  2. I already thought of something like that when I had to pull a car in a drift to a pole in GTA. Of the good options that come to mind / or now come to mind - is to divide the table into clusters, which will activate on colshape which for example a radius of 100 meters and in those 100 meters about 20 positions that you need to handle. Then you don't have to make a huge iteration over the whole table. I hope I explained clearly

  3. 17 minutes ago, RandomRambo said:

    Thanks but I need everyone can see changed model (not only me)

    I checked ur script,u just hide models with empty dff but if I do this, original model of melee weapon (I have gun on original model) will hide too,am I right?

    You need to remove the required object identifiers from the table.

  4. If there was an IDE that would analyze all classes, tables, etc. for the presence of any functions and offer options for the code, that would be great. I once had thoughts of writing my own IDE similar to VisualStudio, with all the useful things from VS, but I feel that it is very difficult and does not make sense.

  5. I remember carefully studying your works. Unfortunately, the site was destroyed by time, but thanks to those people that with the help of the wayback machine they were able to return what was lost. I still keep many of your works on my HDD! Many of them are still useful today, even bone_attach was useful to the community until recently. I am grateful to you for that.

    • Like 1
  6. 15 minutes ago, highwaywarrior said:

    Thanks a lot, but now I can't make it go back to original camera.
    I tried this, but camera doesn't get connected to player it's just detaching from vehicle and not moving at all.

    
    
    detachElements( getCamera() )
    setCameraMatrix ( localPlayer )

     

    try this without detachElements and setCameraMatrix

    setCameraTarget( localPlayer )


     

  7. 2 hours ago, xXBlasterXx said:

    Could you explain more? I don't know how to use this.

     

    I was thinking smoething like that (from user Pa3ck), above is for 2-colors dxDraw, I need for alpha 

    
    addEventHandler ("onClientResourceStart", resourceRoot, 
        function () 
            texture = dxCreateTexture (300, 25)
            local pixels = dxGetTexturePixels (texture)
            for i=0,300 do	 
    			local progress = 100 / 300 * i / 100
    			local r, g, b = interpolateBetween ( 255, 0, 0, 255, 255, 0, progress, "Linear")
                for j=0,25 do
                    dxSetPixelColor (pixels, i, j, r, g, b, 255)
                end
            end
            dxSetTexturePixels (texture, pixels)
    		texture2 = dxCreateTexture (600, 25)
            local pixels2 = dxGetTexturePixels (texture2)
            for i=0,300 do	 
    			local progress = 100 / 300 * i / 100
    			local r, g, b = interpolateBetween ( 255, 255, 0, 0, 255, 0, progress, "Linear")
                for j=0,25 do
                    dxSetPixelColor (pixels2, i, j, r, g, b, 255)
                end
            end
            dxSetTexturePixels (texture2, pixels2)
    	end)
    
    addEventHandler ("onClientRender", root,
        function ()
             dxDrawImage (300, 300, 300, 25, texture)
    		 dxDrawImage (600, 300, 300, 25, texture2)
        end)

    image.png

    local SHADER_CODE = [===[
    	float3 g_f3Color = (float3)0.0;
    	
    	struct PSInput
    	{
    		float4 Position : POSITION0;
    		float2 TexCoord : TEXCOORD0;
    	};
    
    	float4 PixelShaderFunction ( PSInput PS ) : COLOR0
    	{
    		return float4( g_f3Color, 1.0 - PS.TexCoord.x );
    	};
    	
    	technique
    	{
    		pass P0
    		{
    			PixelShader = compile ps_2_a PixelShaderFunction();
    		}
    	}
    ]===];
    
    local _dxDrawRectangle = dxDrawRectangle;
    local g_pShader = dxCreateShader( SHADER_CODE );
    
    function dxDrawRectangle( fX, fY, fWidth, fHeight, pColor, bPostGUI, bLerpAlpha )
    	if ( not bLerpAlpha ) then
    		_dxDrawRectangle( fX, fY, fWidth, fHeight, pColor, bPostGUI );
    	else
    		dxSetShaderValue( g_pShader, "g_f3Color", pColor );
    		dxDrawImage( fX, fY, fWidth, fHeight, g_pShader, 0, 0, 0, -1, bPostGUI );
    	end
    end;
    
    addEventHandler( "onClientRender", root, function ( )
    	dxDrawRectangle( 600, 400, 256, 256, { 0, 0, 0 }, false, true );
    end );

    Please put a reaction to the message, it is on the bottom right. Don't be indifferent.

    • Like 3
  8. 6 hours ago, Dutchman101 said:

    Hmm, sounds like an interesting workaround..

    I am wondering if it looks natural without hitches (heli movement), including for remote players? As well as that it looks as good for laggers (or lagger remote players) as default heli movement would look on their screen? No chance of position or remote player vs local player interpolation desync, or rubberbanding?

    At least i will test it soon and attach a video of how it looks locally, on the heli driver's screen..

    I was able to get a quick acceleration of the helicopter to 180 km / h, and it seems to me that if the acceleration is increased strongly, it will damage the controllability and it will be necessary to make compensators for the rotational speed along the axes.

    https://wiki.multitheftauto.com/wiki/SetElementAngularVelocity

  9. -- Author: XaskeL
    -- Created 06/05/2021
    -- https://forum.multitheftauto.com/topic/130202-question-dx-render-target-rounded-corners/
    
    local SHADER_CODE		= base64Decode( "AQn//gABAAAAAAAAAwAAAAEAAAAwAAAAAAAAAAAAAAAEAAAAAQAAAAAAgD8AAIA/AACAPwAAgD8GAAAAY29sb3IArAADAAAAAAAAAFwAAAAAAAAAAAAAAAEAAAABAAAAUrgePgcAAAByYWRpdXMAAAMAAAAAAAAAiAAAAAAAAAAAAAAAAQAAAAEAAAAK16M7CwAAAGJvcmRlclNvZnQAAAEAAAAAAAAAuAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAEQAAAGNvbG9yT3ZlcndyaXR0ZW4AAAAAAQAAAA8AAAAEAAAAAAAAAAAAAAAAAAAAAwAAAFAwAAAMAAAAcm5kUmVjdFRlY2gABAAAAAEAAAACAAAAAgAAAAQAAAAgAAAAAAAAAAAAAAA8AAAAWAAAAAAAAAAAAAAAaAAAAIQAAAAAAAAAAAAAAJgAAAC0AAAAAAAAAAAAAADwAAAAAAAAAAEAAADoAAAAAAAAAAEAAACTAAAAAAAAANQAAADQAAAAAAAAAAEAAAAAAAAAAAAAAP////8AAAAAAAAAAGgHAAABAv///v9HAENUQUIcAAAA5wAAAAEC//8DAAAAHAAAAAAAACDgAAAAWAAAAAIABgABAAAAZAAAAHQAAACEAAAAAgAFAAEAAACMAAAAnAAAAKwAAAACAAcAAQAAAMAAAADQAAAAYm9yZGVyU29mdACrAAADAAEAAQABAAAAAAAAAArXozsAAAAAAAAAAAAAAABjb2xvcgCrqwEAAwABAAQAAQAAAAAAAAAAAIA/AACAPwAAgD8AAIA/Y29sb3JPdmVy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QAAAwAACIAAAACAAAD/kFgAAAQBAAeABwAAoQAA5JADAKqABQAAAwAAB4ABAOSABADkoAEAAAIACA+AAADkgP//AAA" );
    local g_pShader 		= dxCreateShader( SHADER_CODE );
    local _dxRenderTarget 	= dxDrawRectangle;
    local _tocolor			= tocolor;
    
    local function dxDrawRectangle( fPosX, fPosY, fWidth, fHeight, vColor, bPostDraw, bRound, fRadius, fBorderSoft )
    	if ( not bRound ) then
    		_dxRenderTarget( fPosX, fPosY, fWidth, fHeight, vColor, bPostDraw );
    	else
    		if ( type ( vColor ) == "table" ) then 
    			dxSetShaderValue( g_pShader, "radius", fRadius );
    			dxSetShaderValue( g_pShader, "borderSoft", fBorderSoft );
    			dxSetShaderValue( g_pShader, "color", vColor );
    			
    			dxDrawImage( fPosX, fPosY, fWidth, fHeight, g_pShader, 0, 0, 0, -1, bPostDraw );
    		end
    	end
    end
    
    local function tocolor( iRed, iGreen, iBlue, iAlpha, bToShader )
    	if ( not bToShader ) then
    		return _tocolor( iRed, iGreen, iBlue, iAlpha );
    	else
    		return { iRed / 255, iGreen / 255, iBlue / 255, iAlpha / 255 };
    	end
    end;
    
    local RED = tocolor( 255, 0, 0, 255, true );
    
    addEventHandler( "onClientRender", root, function ( )
    	dxDrawRectangle( 600, 600, 256, 256, RED, false, true, 0.2, 0.01 );
    end );

    I took the shader code from DGS and compiled it (for review, I hope thisdp won't mind). You don't have to drag around a huge number of files if you only need to draw the antialiased corners in dxDrawRectangle. Which you yourself can grab into the RenderTarget.

    • Like 1
  10. Why not try giving some kind of speed boost with vehicle.velocity?

    Write to resource manifest: <oop>true</oop>

    -- Author: XaskeL
    -- Created 05/05/2021
    -- https://forum.multitheftauto.com/topic/130200-speed-of-helicopters
    
    local CAircraftSpeed =
    {
    	addEventHandler 	= addEventHandler;
    	setTimer 			= setTimer;
    	localPlayer			= localPlayer;
    	tostring			= tostring;
    
    	g_iInterval 		= 50;
    	g_fMultVelocity 	= 0.44;
    	g_fVelocityLimit 	= 200;
    	
    	_DEBUG				= true;
    }; CAircraftSpeed.__index = CAircraftSpeed;
    
    setmetatable( CAircraftSpeed, { __index = _G; } );
    
    setfenv( 1, CAircraftSpeed );
    
    if ( _DEBUG ) then
    	addEventHandler( "onClientRender", root, function ( )
    		local pVehicle = localPlayer.vehicle;
    		
    		if ( pVehicle ) then
    			dxDrawText( tostring( pVehicle.velocity.length * 180 ) .. " km/h", 600, 600, 600, 600 );
    		end
    	end );
    end
    
    CAircraftSpeed.OnCheck = function ( )
    	local pVehicle = localPlayer.vehicle;
    	
    	if ( pVehicle and pVehicle.type == "Helicopter" ) then
    		local vecVelocity	  = pVehicle.velocity;
    		local fMultiplyOffset = ( 1.0 + g_fMultVelocity );
    	
    		if ( vecVelocity.length * 180 < g_fVelocityLimit ) then
    			pVehicle.velocity = Vector3( vecVelocity.x * fMultiplyOffset, vecVelocity.y * fMultiplyOffset, vecVelocity.z );
    		end
    	end
    end;
    
    CAircraftSpeed.OnStart = function ( )
    	setTimer( OnCheck, g_iInterval, 0 );
    end;
    
    addEventHandler( "onClientResourceStart", resourceRoot, OnStart );

     

  11. -- Author: XaskeL
    -- Created 04/05/2021
    -- https://forum.multitheftauto.com/topic/130216-help-debug-settings-graphics
    
    local CGraphicsDebug =
    {
    	addEventHandler 				= addEventHandler;
    	dxDrawRectangle 				= dxDrawRectangle;
    	dxDrawText 						= dxDrawText;
    	setTimer 						= setTimer;
    	engineGetVisibleTextureNames 	= engineGetVisibleTextureNames;
    	localPlayer						= localPlayer;
    	guiGetScreenSize				= guiGetScreenSize;
    	resourceRoot					= resourceRoot;
    	root							= root;
    	
    	g_bRenderInfo 					= false;
    	g_iInterval						= 2000;
    	g_bOverlayDraw					= true;
    	
    	BLACK							= tocolor( 0, 0, 0, 255 );
    	WHITE							= -1;
    }; CGraphicsDebug.__index = CGraphicsDebug;
    
    setmetatable( CGraphicsDebug, { __index = _G; } );
    
    setfenv( 1, CGraphicsDebug );
    
    local g_fScreenX, g_fScreenY = guiGetScreenSize( );
    
    CGraphicsDebug.OnRender = function ( )
    	dxDrawRectangle( 0, 0, g_fScreenX, g_fScreenY, BLACK, g_bOverlayDraw );
    	dxDrawText( "Set debug settings to default", 0, 0, g_fScreenX, g_fScreenY, WHITE, 1.0, "bankgothic", "center", "center", false, false, g_bOverlayDraw );
    end;
    
    CGraphicsDebug.OnCheck = function ( )
    	if ( #engineGetVisibleTextureNames( ) < 1 ) then
    		if ( not g_bRenderInfo ) then
    			addEventHandler( "onClientRender", root, OnRender );
    			
    			g_bRenderInfo = true;
    			
    			return;
    		end
    	else
    		if ( g_bRenderInfo ) then
    			removeEventHandler( "onClientRender", root, OnRender );
    			
    			g_bRenderInfo = false;
    			
    			return;
    		end
    	end
    end;
    
    CGraphicsDebug.OnStart = function ( )
    	setTimer( OnCheck, g_iInterval, 0 );
    end;
    
    addEventHandler( "onClientResourceStart", resourceRoot, OnStart );

    Code that is 100% functional and can be used in a client-side project.

    • Thanks 1
  12. local scx, scy = guiGetScreenSize( );
    
    addEventHandler( "onClientRender", root, function ( )
    	if ( #engineGetVisibleTextureNames( ) < 1 ) then
    		dxDrawRectangle( 0, 0, scx, scy, tocolor( 0, 0, 0, 255 ), false );
    	end
    end );

    in theory this should work

    • Thanks 1
×
×
  • Create New...