Remco1337 Posted May 24, 2020 Posted May 24, 2020 Hi, Upon creating of a vehicle I want it to make the data shared and I got the Data stored in a Model. But for any reason the SetEntityData works but the SetEntitySharedData returns an error? Error: Newtonsoft.Json.JsonSerializationException: 'Self referencing loop detected for property 'Trailer' with type 'GTANetworkAPI.Vehicle'. Path 'VehicleData.Trailer'.' Code: public VehicleGameModel(string vehicleName, double vehiclePosX, double vehiclePosY, double vehiclePosZ, float vehicleRotation, int vehicleColor1, int vehicleColor2, string vehicleLicensePlate, bool adminSpawned) { this.VehicleName = vehicleName; this.VehiclePosX = vehiclePosX; this.VehiclePosY = vehiclePosY; this.VehiclePosZ = vehiclePosZ; this.VehiclePosA = vehicleRotation; this.VehicleColor1 = vehicleColor1; this.VehicleColor2 = vehicleColor2; this.VehicleLicensePlate = vehicleLicensePlate; this.AdminSpawned = adminSpawned; VehicleHash vehicleModel = NAPI.Util.VehicleNameToModel(vehicleName); Vector3 vehiclePosition = new Vector3(this.VehiclePosX, this.VehiclePosY, this.VehiclePosZ); this.VehicleData = NAPI.Vehicle.CreateVehicle(vehicleModel, vehiclePosition, this.VehiclePosA, this.VehicleColor1, this.VehicleColor2, this.VehicleLicensePlate, 255, true); NAPI.Data.SetEntitySharedData(this.VehicleData, DataIndentifier, this); //GlobalGameModels.VehiclesList.Add(this); }
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now