Notice: Failed to invoke Pygments: [Called from MediaWiki\SyntaxHighlight\SyntaxHighlight::highlightInner in /home/pi/www/gtac/wiki/wiki/extensions/SyntaxHighlight_GeSHi/includes/SyntaxHighlight.php at line 334] in /home/pi/www/gtac/wiki/wiki/includes/debug/MWDebug.php on line 507
Vehicle Auto Flipper & Fixer - GTA Connected

Vehicle Auto Flipper & Fixer

Revision as of 16:52, 15 August 2018 by Mex (talk | contribs) (Created page with "{{DISPLAYTITLE:Vehicle Auto Flipper & Fixer}} == Description == This code fixes the local player's vehicle and also flips it back if it's upside down, every 10th of a second....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

This code fixes the local player's vehicle and also flips it back if it's upside down, every 10th of a second.

Code

Lua, Client-Side, GTAC versions 1.0.72 and newer:

addEventHandler('onResourceStart', function(event, resource)
	if resource ~= thisResource then return end
	setInterval(function()
		if not localPlayer.vehicle then return end
		localPlayer.vehicle:fix()
		if not localPlayer.vehicle.flipped then return end
		if flippingVehicle then return end
		flippingVehicle = true
		local v = localPlayer.vehicle.velocity
		local t = localPlayer.vehicle.turnVelocity
		localPlayer.vehicle.velocity = {v.x, v.y, v.z + 0.14}
		localPlayer.vehicle.turnVelocity = {t.x + 0.12, t.y - 0.11, t.z}
		setTimeout(function()
			localPlayer.vehicle:fix()
			flippingVehicle = false
		end, 1000)
	end, 100)
end)