Jump to content

Recommended Posts

Posted

Does anyone has working example how to edit vehicle handling? I have one, but that isn't perfect,  because  handling only changes when vehicle goes out of stream and then back. For example, every time when I edit handling I need to teleport away from vehicle and then back.

mp.events.add('UpdateVehicleHandling', (json, save = false) => {
	//mp.gui.chat.push("json " + json);
	if (json == null || json == "" || json == "[]") { return; }
	var obj = JSON.parse(json);
	for (var key in obj) {
		var value = obj[key];
		if(key.toString() == "maxSpeed") {
			mp.players.local.vehicle.setMaxSpeed(value);
		}
		else {
			mp.players.local.vehicle.setHandling(key.toString(), value);
		}
	}
	mp.players.local.vehicle.model = mp.players.local.vehicle.model
	
	if(save == true) {
		mp.events.callRemote("saveDealerVehicleHandling", json);
	}
});

 

  • 1 month later...
  • 2 years later...

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