Sign in to follow this  
Duarte

SetVehicleHandling

Recommended Posts

Preciso de ajuda!
Modelos de SetVehicleHandling na Wiki, mas não sei usa-los!
Já coloquei como script normal, como manager, como resource ... Nada funciona.
Alguém pode me ajudar ??

Edited by Duarte
Ficou tudo errado após o envio, está bugado!

Share this post


Link to post

é so pegar o modelo que ta no wiki jogar em alguma script server-side.

 

Obs: poste na área correta

Edited by Furzy

Share this post


Link to post

tenho um script de minha autoria que faz oq vc precisa, é facil de modificar ele. Pode usar ele, portanto que não remova os créditos :)

Espero ter ajudado!

Server:

--[[



 ################################################
 #                                              #
 #              Script Criado Por               #
 #                 [D]ener189                   #
 #                                              #
 #                                              #
 ################################################



--]]

------------------------------------------------------------------------------------------------------------------------------------------------------

local predefinedHandling = {
	[411] = { --ID do Veiculo
		["engineAcceleration"] = 35,
		["dragCoeff"] = 0,
		["maxVelocity"] = 260, --310Km
		["tractionMultiplier"] = 0.8,
		["tractionLoss"] = 1.1,
	},
		[562] = { --Handler Drift
		["driveType"] = "rwd",
		["engineAcceleration"] = 200,
		["dragCoeff"] = 1.5,
		["maxVelocity"] = 202,
		["tractionMultiplier"] = 0.7,
		["tractionLoss"] = 0.8,
		["collisionDamageMultiplier"] = 0.4,
		["engineInertia"] = -175,
		["steeringLock"] = 75,
		["numberOfGears"] = 4,
		["suspensionForceLevel"] = 0.8,
		["suspensionDamping"] = 0.8,
		["suspensionUpperLimit"] = 0.33,
		["suspensionFrontRearBias"] = 0.3,
		["mass"] = 1800,
		["turnMass"] = 3000,
		["centerOfMass"] = { [1]=0, [2]=-0.2, [3]=-0.5 },
	},
}

for i,v in pairs (predefinedHandling) do
	if i then
		for handling, value in pairs (v) do
			if not setModelHandling (i, handling, value) then
				outputDebugString ("* Predefined handling '"..tostring(handling).."' for vehicle model '"..tostring(i).."' could not be set to '"..tostring(value).."'")
			end
		end
	end
end

for _,v in ipairs (getElementsByType("vehicle")) do
	if v and predefinedHandling[getElementModel(v)] then
		for k,vl in pairs (predefinedHandling[getElementModel(v)]) do
			setVehicleHandling (v, k, vl)
		end
	end
end

function resetHandling()
	for model in pairs (predefinedHandling) do
		if model then
			for k in pairs(getOriginalHandling(model)) do
				setModelHandling(model, k, nil)
			end
		end
	end

	for _,v in ipairs (getElementsByType("vehicle")) do
		if v then
			local model = getElementModel(v)
			if predefinedHandling[model] then
				for k,h in pairs(getOriginalHandling(model)) do
					setVehicleHandling(v, k, h)
				end
			end
		end
	end
end
addEventHandler("onResourceStop", resourceRoot, resetHandling)

Meta:

<meta>
     <info author="[D]ener189" name="Handler" version="1.0" description="Velocidade Modificada Hurley Roleplay" type="script" />
  
     <script src="handler.Lua" type="server"/>
</meta>

 

Edited by dener189

Share this post


Link to post

Tópico movido para Portuguese / Português > Programação em Lua

@Duarte

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.