@nativewrappers/fivem 0.0.103 → 0.0.104
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/models/Player.d.ts +10 -2
- package/models/Player.js +18 -2
- package/package.json +1 -1
package/models/Player.d.ts
CHANGED
|
@@ -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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|