@nativewrappers/fivem 0.0.108 → 0.0.110

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.
package/World.d.ts CHANGED
@@ -426,7 +426,7 @@ export declare abstract class World {
426
426
  * Gets the cloest [[`Vehicle`]] to the current coords, or null if none are found
427
427
  * @returns the closest vehicle or null
428
428
  */
429
- static getClosestVehicle(coords: Vector3): Vehicle | null;
429
+ static getClosestVehicle(coords: Vector3, startingDistance?: number): Vehicle | null;
430
430
  /**
431
431
  * Get all [[`Pickup`]] entities using the GetGamePool.
432
432
  * @returns Array of Pickups.
package/World.js CHANGED
@@ -874,10 +874,10 @@ class World {
874
874
  * Gets the cloest [[`Vehicle`]] to the current coords, or null if none are found
875
875
  * @returns the closest vehicle or null
876
876
  */
877
- static getClosestVehicle(coords) {
877
+ static getClosestVehicle(coords, startingDistance = 9999) {
878
878
  const vehicles = this.getAllVehicles();
879
879
  let currentVeh = null;
880
- let lastDistance = 9999;
880
+ let lastDistance = startingDistance;
881
881
  for (const vehicle of vehicles) {
882
882
  if (!currentVeh) {
883
883
  currentVeh = vehicle;
package/models/Ped.d.ts CHANGED
@@ -25,7 +25,7 @@ export declare class Ped extends BaseEntity {
25
25
  private static readonly speechModifierNames;
26
26
  private tasks;
27
27
  constructor(handle: number);
28
- get Player(): Player;
28
+ get Player(): Player | null;
29
29
  get Money(): number;
30
30
  set Money(amount: number);
31
31
  get Gender(): Gender;
package/models/Ped.js CHANGED
@@ -79,7 +79,11 @@ class Ped extends BaseEntity {
79
79
  super(handle);
80
80
  }
81
81
  get Player() {
82
- return new Player(NetworkGetPlayerIndexFromPed(this.handle));
82
+ const playerIndex = NetworkGetPlayerIndexFromPed(this.handle);
83
+ if (playerIndex === -1) {
84
+ return null;
85
+ }
86
+ return new Player(playerIndex);
83
87
  }
84
88
  get Money() {
85
89
  return GetPedMoney(this.handle);
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "license": "MIT",
10
10
  "type": "module",
11
- "version": "0.0.108",
11
+ "version": "0.0.110",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/nativewrappers/nativewrappers.git"