@nativewrappers/server 0.0.107 → 0.0.108

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.
@@ -4,7 +4,8 @@ import { Ped } from "./Ped";
4
4
  export declare class Player {
5
5
  private readonly source;
6
6
  protected type: ClassTypes;
7
- constructor(source: number);
7
+ constructor(source: any);
8
+ fromServerId(serverId: number): Player | null;
8
9
  /**
9
10
  * Get an interable list of players currently on the server
10
11
  * @returns Iterable list of Players.
@@ -12,6 +13,11 @@ export declare class Player {
12
13
  static AllPlayers(): IterableIterator<Player>;
13
14
  get Exists(): boolean;
14
15
  get Source(): number;
16
+ /**
17
+ * @returns the handle of the current player, this will be a number type, but we return 'any'
18
+ * so we don't have to deal with annoying type differences between native calls
19
+ */
20
+ get Handle(): any;
15
21
  get State(): StateBagInterface;
16
22
  /**
17
23
  * Returns the player source casted as a string
@@ -21,7 +27,7 @@ export declare class Player {
21
27
  get Tokens(): string[];
22
28
  get Identifiers(): string[];
23
29
  get Endpoint(): string;
24
- get CamerRotation(): Vector3;
30
+ get CameraRotation(): Vector3;
25
31
  /**
26
32
  * Returns the time since the last player UDP message
27
33
  */
@@ -13,6 +13,12 @@ class Player {
13
13
  __name(this, "Player");
14
14
  }
15
15
  type = ClassTypes.Player;
16
+ fromServerId(serverId) {
17
+ if (!DoesPlayerExist(serverId)) {
18
+ return null;
19
+ }
20
+ return new Player(serverId);
21
+ }
16
22
  /**
17
23
  * Get an interable list of players currently on the server
18
24
  * @returns Iterable list of Players.
@@ -29,6 +35,13 @@ class Player {
29
35
  get Source() {
30
36
  return this.source;
31
37
  }
38
+ /**
39
+ * @returns the handle of the current player, this will be a number type, but we return 'any'
40
+ * so we don't have to deal with annoying type differences between native calls
41
+ */
42
+ get Handle() {
43
+ return this.source;
44
+ }
32
45
  get State() {
33
46
  return cfx.Player(this.source).state;
34
47
  }
@@ -39,7 +52,8 @@ class Player {
39
52
  return this.source;
40
53
  }
41
54
  get Ped() {
42
- return new Ped(GetPlayerPed(this.Src));
55
+ const ped = GetPlayerPed(this.source);
56
+ return new Ped(GetPlayerPed(this.source));
43
57
  }
44
58
  get Tokens() {
45
59
  return getPlayerTokens(this.source);
@@ -48,9 +62,9 @@ class Player {
48
62
  return getPlayerIdentifiers(this.source);
49
63
  }
50
64
  get Endpoint() {
51
- return GetPlayerEndpoint(this.Src);
65
+ return GetPlayerEndpoint(this.source);
52
66
  }
53
- get CamerRotation() {
67
+ get CameraRotation() {
54
68
  return Vector3.fromArray(GetPlayerCameraRotation(this.Src));
55
69
  }
56
70
  /**
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "license": "MIT",
10
10
  "type": "module",
11
- "version": "0.0.107",
11
+ "version": "0.0.108",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/nativewrappers/nativewrappers.git"