@nativewrappers/fivem 0.0.103 → 0.0.105

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.
@@ -184,4 +184,14 @@ export declare abstract class BaseEntity {
184
184
  * @deprecated use [[IsMissionEntity]] setter as false instead.
185
185
  */
186
186
  markAsNoLongerNeeded(): void;
187
+ /**
188
+ * @returns the current interior id that the entity is in, or 0 if they're outside
189
+ */
190
+ get Interior(): number;
191
+ /**
192
+ * @returns the room key hash that the entity is in, or 0 if they're outside
193
+ */
194
+ get RoomKey(): number;
195
+ clearInterior(): void;
196
+ forceRoom(interiorId: number, roomKey: number): void;
187
197
  }
@@ -549,6 +549,24 @@ class BaseEntity {
549
549
  markAsNoLongerNeeded() {
550
550
  SetEntityAsNoLongerNeeded(this.Handle);
551
551
  }
552
+ /**
553
+ * @returns the current interior id that the entity is in, or 0 if they're outside
554
+ */
555
+ get Interior() {
556
+ return GetInteriorFromEntity(this.handle);
557
+ }
558
+ /**
559
+ * @returns the room key hash that the entity is in, or 0 if they're outside
560
+ */
561
+ get RoomKey() {
562
+ return GetRoomKeyFromEntity(this.handle);
563
+ }
564
+ clearInterior() {
565
+ ClearInteriorForEntity(this.handle);
566
+ }
567
+ forceRoom(interiorId, roomKey) {
568
+ ForceRoomForEntity(this.handle, interiorId, roomKey);
569
+ }
552
570
  }
553
571
  export {
554
572
  BaseEntity
@@ -11,8 +11,16 @@ export declare class Player {
11
11
  private source;
12
12
  private type;
13
13
  static AllPlayers(excludeLocalPlayer?: boolean): IterableIterator<Player>;
14
- static fromPedHandle(handle: number): Player;
15
- static fromServerId(serverId: number): Player;
14
+ /**
15
+ * @param handle the handoe of the ped to get the player of
16
+ * @returns the player, or null if the player doesn't exist
17
+ */
18
+ static fromPedHandle(handle: number): Player | null;
19
+ /**
20
+ * @param serverId the server id to get the player of
21
+ * @returns the player, or null if the player doesn't exist
22
+ */
23
+ static fromServerId(serverId: number): Player | null;
16
24
  /**
17
25
  * @param [minimumDistance=Number.MAX_VALUE] the minimum distance this should check
18
26
  * @param [fromPlayer=GameConstants.Player] the player to get the distance from
package/models/Player.js CHANGED
@@ -25,11 +25,27 @@ class Player {
25
25
  yield new Player(ply);
26
26
  }
27
27
  }
28
+ /**
29
+ * @param handle the handoe of the ped to get the player of
30
+ * @returns the player, or null if the player doesn't exist
31
+ */
28
32
  static fromPedHandle(handle) {
29
- return new Player(NetworkGetPlayerIndexFromPed(handle));
33
+ const playerHandle = NetworkGetPlayerIndexFromPed(handle);
34
+ if (!handle) {
35
+ return null;
36
+ }
37
+ return new Player(playerHandle);
30
38
  }
39
+ /**
40
+ * @param serverId the server id to get the player of
41
+ * @returns the player, or null if the player doesn't exist
42
+ */
31
43
  static fromServerId(serverId) {
32
- return new Player(GetPlayerFromServerId(serverId));
44
+ const player = GetPlayerFromServerId(serverId);
45
+ if (player === -1) {
46
+ return null;
47
+ }
48
+ return new Player(player);
33
49
  }
34
50
  /**
35
51
  * @param [minimumDistance=Number.MAX_VALUE] the minimum distance this should check
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "license": "MIT",
10
10
  "type": "module",
11
- "version": "0.0.103",
11
+ "version": "0.0.105",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/nativewrappers/nativewrappers.git"