From 4968f7b669d6a7304d89fc99c8d4551759c92850 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:25:07 +1100 Subject: [PATCH] fix(server/vehicle): set initial vehicle plate --- server/vehicle/class.ts | 6 ++++++ server/vehicle/index.ts | 8 +------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/vehicle/class.ts b/server/vehicle/class.ts index 09f0f72a..28373c60 100644 --- a/server/vehicle/class.ts +++ b/server/vehicle/class.ts @@ -164,8 +164,13 @@ export class OxVehicle extends ClassInterface { if (this.id) this.setStored(null, false); OxVehicle.add(this.entity, this); + SetVehicleNumberPlateText(this.entity, properties.plate || this.plate); setVehicleProperties(entity, properties); emit('ox:spawnedVehicle', this.entity, this.id); + + const state = this.getState(); + + state.set('initVehicle', true, true); } /** Stores a value in the vehicle's metadata. */ @@ -267,6 +272,7 @@ export class OxVehicle extends ClassInterface { if (rotation) SetEntityRotation(this.entity, rotation.x, rotation.y, rotation.z, 2, false); OxVehicle.add(this.entity, this); + SetVehicleNumberPlateText(this.entity, this.#properties.plate || this.plate); setVehicleProperties(this.entity, this.#properties); emit('ox:spawnedVehicle', this.entity, this.id); } diff --git a/server/vehicle/index.ts b/server/vehicle/index.ts index 2674d5c3..b1a1df03 100644 --- a/server/vehicle/index.ts +++ b/server/vehicle/index.ts @@ -80,7 +80,7 @@ export async function CreateVehicle( if (!entity) return; - const vehicle = new OxVehicle( + return new OxVehicle( entity, invokingScript, data.plate, @@ -94,12 +94,6 @@ export async function CreateVehicle( data.owner, data.group ); - - const state = vehicle.getState(); - - state.set('initVehicle', true, true); - - return vehicle; } export async function SpawnVehicle(id: number, coords: Vec3, heading?: number) {