Jump to content

speed of helicopters


Recommended Posts

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 );

 

Edited by XaskeL
Link to comment
  • MTA Anti-Cheat Team
3 hours ago, XaskeL said:

Why not try giving some kind of speed boost with vehicle.velocity?

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..

Link to comment
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

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...