Skip to content

Commit

Permalink
fix(server/vehicle): set initial vehicle plate
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Oct 25, 2024
1 parent 978bbfb commit 4968f7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 6 additions & 0 deletions server/vehicle/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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);
}
Expand Down
8 changes: 1 addition & 7 deletions server/vehicle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export async function CreateVehicle(

if (!entity) return;

const vehicle = new OxVehicle(
return new OxVehicle(
entity,
invokingScript,
data.plate,
Expand All @@ -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) {
Expand Down

0 comments on commit 4968f7b

Please sign in to comment.