@communityox/ox_core 1.5.4 → 1.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import type { OxVehicle as _OxVehicle } from '../../server/vehicle/class';
2
2
  import type { CreateVehicleData } from '../../server/vehicle';
3
+ import type { VehicleRow } from '../../server/vehicle/db';
3
4
  declare class VehicleInterface {
4
5
  entity: number | undefined;
5
6
  netId: number | undefined;
@@ -17,9 +18,11 @@ declare class VehicleInterface {
17
18
  }
18
19
  export type OxVehicle = _OxVehicle & VehicleInterface;
19
20
  export declare function GetVehicle(entityId: number): OxVehicle;
21
+ export declare function GetVehicle(vin: string): OxVehicle;
22
+ export declare function GetVehicleFromEntity(entityId: number): OxVehicle;
20
23
  export declare function GetVehicleFromNetId(netId: number): OxVehicle;
21
24
  export declare function GetVehicleFromVin(vin: string): OxVehicle;
22
- export declare function CreateVehicle(data: CreateVehicleData, coords?: number | number[] | {
25
+ export declare function CreateVehicle(data: string | (CreateVehicleData & Partial<VehicleRow>), coords?: number | number[] | {
23
26
  x: number;
24
27
  y: number;
25
28
  z: number;
@@ -49,8 +49,11 @@ VehicleInterface.prototype.toString = function () {
49
49
  function CreateVehicleInstance(vehicle) {
50
50
  return new VehicleInterface(vehicle.entity, vehicle.netId, vehicle.script, vehicle.plate, vehicle.model, vehicle.make, vehicle.id, vehicle.vin, vehicle.owner, vehicle.group);
51
51
  }
52
- export function GetVehicle(vin) {
53
- return typeof vin === 'string' ? GetVehicleFromVin(vin) : CreateVehicleInstance(exports.ox_core.GetVehicle(vin));
52
+ export function GetVehicle(handle) {
53
+ return typeof handle === 'string' ? GetVehicleFromVin(handle) : GetVehicleFromEntity(handle);
54
+ }
55
+ export function GetVehicleFromEntity(entityId) {
56
+ return CreateVehicleInstance(exports.ox_core.GetVehicleFromEntity(entityId));
54
57
  }
55
58
  export function GetVehicleFromNetId(netId) {
56
59
  return CreateVehicleInstance(exports.ox_core.GetVehicleFromNetId(netId));
@@ -1,6 +1,8 @@
1
1
  import type { OxGroup, CreateGroupProperties } from '../../types';
2
2
  export declare function GetGroup(name: string): OxGroup;
3
3
  export declare function GetGroupsByType(type: string): string[];
4
+ export declare function GetGroupActivePlayers(groupName: string): number[];
5
+ export declare function GetGroupActivePlayersByType(type: string): number[];
4
6
  export declare function SetGroupPermission(groupName: string, grade: number, permission: string, value: 'allow' | 'deny'): void;
5
7
  export declare function RemoveGroupPermission(groupName: string, grade: number, permission: string): void;
6
8
  export declare function CreateGroup(data: CreateGroupProperties): Promise<void>;
@@ -32,12 +32,12 @@ export declare class OxVehicle extends ClassInterface {
32
32
  static generateVin({ make, name }: VehicleData, isOwned?: boolean): Promise<string>;
33
33
  static generatePlate(): Promise<string>;
34
34
  static saveAll(resource?: string): void;
35
- constructor(vin: string, script: string, plate: string, model: string, make: string, stored: string | null, metadata: Dict<any>, properties: VehicleProperties, id?: number, owner?: number, group?: string);
35
+ constructor(vin: string, script: string, plate: string, model: string, make: string, stored: string | null, metadata: Dict<any>, properties: Partial<VehicleProperties>, id?: number, owner?: number, group?: string);
36
36
  set(key: string, value: any): void;
37
37
  get(key: string): any;
38
38
  getState(): StateBagInterface | null;
39
39
  getStored(): string | null;
40
- getProperties(): VehicleProperties;
40
+ getProperties(): Partial<VehicleProperties>;
41
41
  save(): Promise<number> | Promise<import("mariadb").UpsertResult | import("mariadb").UpsertResult[]> | undefined;
42
42
  despawn(save?: boolean): void;
43
43
  delete(): void;
@@ -46,6 +46,6 @@ export declare class OxVehicle extends ClassInterface {
46
46
  setOwner(charId?: number): void;
47
47
  setGroup(group?: string): void;
48
48
  setPlate(plate: string): void;
49
- setProperties(properties: VehicleProperties, apply?: boolean): void;
49
+ setProperties(properties: Partial<VehicleProperties>, apply?: boolean): void;
50
50
  respawn(coords?: Vec3, rotation?: Vector3 | number): number | null;
51
51
  }
@@ -7,7 +7,7 @@ export type VehicleRow = {
7
7
  vin: string;
8
8
  model: string;
9
9
  data: {
10
- properties: VehicleProperties;
10
+ properties: Partial<VehicleProperties>;
11
11
  [key: string]: any;
12
12
  };
13
13
  };
@@ -9,7 +9,7 @@ export interface CreateVehicleData {
9
9
  owner?: number;
10
10
  group?: string;
11
11
  stored?: string;
12
- properties?: VehicleProperties;
12
+ properties?: Partial<VehicleProperties>;
13
13
  }
14
14
  export declare function CreateVehicle(data: string | (CreateVehicleData & Partial<VehicleRow>), coords?: Vec3, heading?: number, invokingScript?: string): Promise<OxVehicle>;
15
15
  export declare function SpawnVehicle(id: number | string, coords?: Vec3, heading?: number): Promise<OxVehicle | undefined>;
@@ -114,6 +114,7 @@ export interface DbGroup {
114
114
  type?: string;
115
115
  colour?: number;
116
116
  hasAccount: boolean;
117
+ activePlayers: Set<number>;
117
118
  }
118
119
  export interface OxGroup extends DbGroup {
119
120
  grades: string[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@communityox/ox_core",
3
3
  "author": "Overextended",
4
- "version": "1.5.4",
4
+ "version": "1.5.6",
5
5
  "license": "LGPL-3.0-or-later",
6
6
  "description": "A modern FiveM framework.",
7
7
  "type": "module",
@@ -16,10 +16,10 @@
16
16
  "./server": "./package/lib/server/index.js"
17
17
  },
18
18
  "scripts": {
19
- "build": "node build.js",
20
- "watch": "node build.js --watch",
21
- "format": "pnpm biome format --write",
22
- "lint": "pnpm biome lint --write"
19
+ "build": "bun run build.js",
20
+ "watch": "bun run build.js --watch",
21
+ "format": "bun run biome format --write",
22
+ "lint": "bun run biome lint --write"
23
23
  },
24
24
  "keywords": [
25
25
  "fivem",