Jump to content

Recommended Posts

Posted

Hi

When I spawn or change the model of a vehicle from the clientside, in the console I get the following error.

System.NullReferenceException: Object reference not set to an instance of an object.
   at void GTANetworkInternals.RemoteEventParser.Parse(Player sender, ulong eventNameHash, object[] args)

The code works,  the vehicle changes model and everything is fine, but the error appears for each model change, so I get the same error every time a user wants to buy a vehicle and choose the vehicle model.

The spawn code is:

auto.entity = mp.vehicles.new(mp.game.joaat(dataVehicles.Vehicles[0].Model), new mp.Vector3(-42.79771, -1095.676, 26.0117),
	{
		alpha: 255,
		color: [[0, 0, 0], [0, 0, 0]],
		locked: true,
		engine: false,
		dimension: dim
	});
    auto.entity.setRotation(0, 0, 0, 2, true);

And the change model code is:

auto.entity.model = mp.game.joaat(auto.vehiclesList[value].Model);

Any idea to fix the error?

 

Thx

  • 2 weeks 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...