@cybermp/client-types 2.2.2 → 2.3.2

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,37 +1,37 @@
1
- /**
2
- * Interface providing access to persistent client-side key-value storage.
3
- * Data saved here remains available across different game sessions and server reconnections.
4
- */
5
- export interface MpLocalStorage {
6
- /**
7
- * Associates a string value with a specific key in the storage database.
8
- * If the key already exists, its value will be overwritten.
9
- * @param key - The unique identifier name for the storage entry.
10
- * @param value - The plaintext string data payload to be stored.
11
- */
12
- set(key: string, value: string): void;
13
-
14
- /**
15
- * Retrieves the stored string value associated with the specified key.
16
- * @param key - The unique identifier name of the entry to fetch.
17
- * @returns The stored string value, or an empty string/null if the key does not exist.
18
- */
19
- get(key: string): string;
20
-
21
- /**
22
- * Permanently removes a specific key-value entry from the storage map.
23
- * @param key - The unique identifier name of the entry to delete.
24
- */
25
- delete(key: string): void;
26
-
27
- /**
28
- * Clears all keys and values currently held in this resource's local storage instance.
29
- */
30
- deleteAll(): void;
31
-
32
- /**
33
- * Explicitly flushes the current state of the in-memory storage data down to the physical disk.
34
- * Use this to ensure volatile data isn't lost if the game client unexpectedly crashes.
35
- */
36
- save(): void;
37
- }
1
+ /**
2
+ * Interface providing access to persistent client-side key-value storage.
3
+ * Data saved here remains available across different game sessions and server reconnections.
4
+ */
5
+ export interface MpLocalStorage {
6
+ /**
7
+ * Associates a string value with a specific key in the storage database.
8
+ * If the key already exists, its value will be overwritten.
9
+ * @param key - The unique identifier name for the storage entry.
10
+ * @param value - The plaintext string data payload to be stored.
11
+ */
12
+ set(key: string, value: string): void;
13
+
14
+ /**
15
+ * Retrieves the stored string value associated with the specified key.
16
+ * @param key - The unique identifier name of the entry to fetch.
17
+ * @returns The stored string value, or an empty string/null if the key does not exist.
18
+ */
19
+ get(key: string): string;
20
+
21
+ /**
22
+ * Permanently removes a specific key-value entry from the storage map.
23
+ * @param key - The unique identifier name of the entry to delete.
24
+ */
25
+ delete(key: string): void;
26
+
27
+ /**
28
+ * Clears all keys and values currently held in this resource's local storage instance.
29
+ */
30
+ deleteAll(): void;
31
+
32
+ /**
33
+ * Explicitly flushes the current state of the in-memory storage data down to the physical disk.
34
+ * Use this to ensure volatile data isn't lost if the game client unexpectedly crashes.
35
+ */
36
+ save(): void;
37
+ }
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Manages local player lifecycle operations and the creation of client-side entities.
3
+ */
4
+ export interface MpLocal {
5
+ /**
6
+ * Spawns local player
7
+ * @param x - Horizontal grid position coordinate value.
8
+ * @param y - Vertical grid position coordinate value.
9
+ * @param z - Height grid elevation coordinate value.
10
+ * @param yaw - The horizontal rotation layout angle in degrees.
11
+ * @returns `true` if the spawn lifecycle sequence initiated successfully, otherwise `false`.
12
+ */
13
+ spawnPlayer(x: number, y: number, z: number, yaw: number): boolean;
14
+
15
+ /**
16
+ * Instantiates a localized ped entity.
17
+ * This entity remains completely un-synchronized and invisible to other remote clients.
18
+ * @param skinHash - Asset model signature key hash.
19
+ * @param appHash - Visual appearance setup key components variation hash.
20
+ * @param x - Horizontal coordinate space.
21
+ * @param y - Vertical coordinate space.
22
+ * @param z - Elevation height space coordinate.
23
+ * @param yaw - Rotational alignment facing angle.
24
+ * @param streaming - Controls if engine virtualization automatically handles streaming boundaries tracking.
25
+ * @returns The resulting unique local game entity handle ID.
26
+ */
27
+ spawnPed(
28
+ skinHash: number | bigint,
29
+ appHash: number | bigint,
30
+ x: number,
31
+ y: number,
32
+ z: number,
33
+ yaw: number,
34
+ streaming: boolean,
35
+ ): number;
36
+
37
+ /**
38
+ * Instantiates a localized vehicle entity inside the engine environment.
39
+ * This entity remains completely un-synchronized and invisible to other remote clients.
40
+ * @param skinHash - Asset model signature key hash.
41
+ * @param appHash - Visual appearance setup key components variation hash.
42
+ * @param x - Horizontal coordinate space.
43
+ * @param y - Vertical coordinate space.
44
+ * @param z - Elevation height space coordinate.
45
+ * @param roll - Longitudinal rotation axis orientation angle.
46
+ * @param pitch - Lateral rotation axis orientation angle.
47
+ * @param yaw - Directional heading alignment angle.
48
+ * @param streaming - Controls if engine virtualization automatically handles streaming boundaries tracking.
49
+ * @returns The resulting unique local game entity handle ID.
50
+ */
51
+ spawnVehicle(
52
+ skinHash: number | bigint,
53
+ appHash: number | bigint,
54
+ x: number,
55
+ y: number,
56
+ z: number,
57
+ roll: number,
58
+ pitch: number,
59
+ yaw: number,
60
+ streaming: boolean,
61
+ ): number;
62
+
63
+ /**
64
+ * Instantiates a localized world object or dynamic prop entity inside the engine environment.
65
+ * This entity remains completely un-synchronized and invisible to other remote clients.
66
+ * @param skinHash - Asset model signature key hash.
67
+ * @param appHash - Visual appearance setup key components variation hash.
68
+ * @param x - Horizontal coordinate space.
69
+ * @param y - Vertical coordinate space.
70
+ * @param z - Elevation height space coordinate.
71
+ * @param roll - Longitudinal rotation axis orientation angle.
72
+ * @param pitch - Lateral rotation axis orientation angle.
73
+ * @param yaw - Directional heading alignment angle.
74
+ * @param streaming - Controls if engine virtualization automatically handles streaming boundaries tracking.
75
+ * @returns The resulting unique local game entity handle ID.
76
+ */
77
+ spawnObject(
78
+ skinHash: bigint | number,
79
+ appHash: bigint | number,
80
+ x: number,
81
+ y: number,
82
+ z: number,
83
+ roll: number,
84
+ pitch: number,
85
+ yaw: number,
86
+ streaming: boolean,
87
+ ): number;
88
+
89
+ /**
90
+ * Forces immediate engine de-allocation and cleanup deletion maps targeting an isolated local pedestrian.
91
+ * @param hash - Unique local game engine entity instance handle to clear.
92
+ */
93
+ despawnPed(hash: number): void;
94
+
95
+ /**
96
+ * Forces immediate engine de-allocation and cleanup deletion maps targeting an isolated local vehicle.
97
+ * @param hash - Unique local game engine entity instance handle to clear.
98
+ */
99
+ despawnVehicle(hash: number): void;
100
+
101
+ /**
102
+ * Forces immediate engine de-allocation and cleanup deletion maps targeting an isolated local object.
103
+ * @param hash - Unique local game engine entity instance handle to clear.
104
+ */
105
+ despawnObject(hash: number): void;
106
+ }
@@ -1,78 +1,78 @@
1
- /**
2
- * Interface managing cross-resource and synchronized state metadata across the network layer.
3
- * Allows attaching arbitrary data structures to globals, specific players, the local player, or synchronized network entities.
4
- */
5
- export interface MpMeta {
6
- /**
7
- * Sets a global metadata value accessible across the entire runtime environment.
8
- * @param key - The unique identifier string for the metadata entry.
9
- * @param value - The data payload to store (can be any serializable object or primitive).
10
- * @param sync - Optional flag. If `true`, synchronizes this metadata across the network to all other clients.
11
- */
12
- setGlobalMeta(key: string, value: any, sync?: boolean): void;
13
-
14
- /**
15
- * Retrieves a global metadata value by its key.
16
- * @template T - The expected type of the returned metadata value.
17
- * @param key - The unique identifier string of the metadata entry to look up.
18
- * @returns The stored global metadata value cast to type T, or undefined if it does not exist.
19
- */
20
- getGlobalMeta<T = any>(key: string): T;
21
-
22
- /**
23
- * Assigns a metadata value to a specific remote player using their unique player network ID.
24
- * @param playerId - The network identification integer of the target player.
25
- * @param key - The unique identifier string for this player's metadata entry.
26
- * @param value - The data payload to attach to the player.
27
- * @param sync - Optional flag. If `true`, syncs this change to all other connected clients over the network.
28
- */
29
- setPlayerMeta(
30
- playerId: number,
31
- key: string,
32
- value: any,
33
- sync?: boolean,
34
- ): void;
35
-
36
- /**
37
- * Retrieves a metadata value attached to a specific remote player.
38
- * @template T - The expected type of the returned metadata value.
39
- * @param playerId - The network identification integer of the target player.
40
- * @param key - The unique identifier string of the player's metadata entry.
41
- * @returns The stored metadata value cast to type T, or undefined if it does not exist.
42
- */
43
- getPlayerMeta<T = any>(playerId: number, key: string): T;
44
-
45
- /**
46
- * Sets a metadata value restricted or assigned specifically to the local player instance.
47
- * @param key - The unique identifier string for the local player's metadata entry.
48
- * @param value - The data payload to store.
49
- * @param sync - Optional flag. If `true`, relays this local metadata state out to the server and other clients.
50
- */
51
- setLocalPlayerMeta(key: string, value: any, sync?: boolean): void;
52
-
53
- /**
54
- * Retrieves a metadata value attached specifically to the local player instance.
55
- * @template T - The expected type of the returned metadata value.
56
- * @param key - The unique identifier string of the local player's metadata entry.
57
- * @returns The stored metadata value cast to type T, or undefined if it does not exist.
58
- */
59
- getLocalPlayerMeta<T = any>(key: string): T;
60
-
61
- /**
62
- * Attaches a metadata state payload to any synchronized network entity (e.g., vehicles, props, peds) using its network ID.
63
- * @param netId - The network-assigned unique identifier tracking the target entity.
64
- * @param key - The unique identifier string for the entity's metadata entry.
65
- * @param value - The data payload to attach to the entity.
66
- * @param sync - Optional flag. If `true`, synchronizes this entity metadata property to all clients tracking this object.
67
- */
68
- setEntityMeta(netId: number, key: string, value: any, sync?: boolean): void;
69
-
70
- /**
71
- * Retrieves a metadata value associated with a synchronized network entity.
72
- * @template T - The expected type of the returned metadata value.
73
- * @param netId - The network-assigned unique identifier tracking the target entity.
74
- * @param key - The unique identifier string of the entity's metadata entry.
75
- * @returns The stored metadata value cast to type T, or undefined if it does not exist.
76
- */
77
- getEntityMeta<T = any>(netId: number, key: string): T;
78
- }
1
+ /**
2
+ * Interface managing cross-resource and synchronized state metadata across the network layer.
3
+ * Allows attaching arbitrary data structures to globals, specific players, the local player, or synchronized network entities.
4
+ */
5
+ export interface MpMeta {
6
+ /**
7
+ * Sets a global metadata value accessible across the entire runtime environment.
8
+ * @param key - The unique identifier string for the metadata entry.
9
+ * @param value - The data payload to store (can be any serializable object or primitive).
10
+ * @param sync - Optional flag. If `true`, synchronizes this metadata across the network to all other clients.
11
+ */
12
+ setGlobalMeta(key: string, value: any, sync?: boolean): void;
13
+
14
+ /**
15
+ * Retrieves a global metadata value by its key.
16
+ * @template T - The expected type of the returned metadata value.
17
+ * @param key - The unique identifier string of the metadata entry to look up.
18
+ * @returns The stored global metadata value cast to type T, or undefined if it does not exist.
19
+ */
20
+ getGlobalMeta<T = any>(key: string): T;
21
+
22
+ /**
23
+ * Assigns a metadata value to a specific remote player using their unique player network ID.
24
+ * @param playerId - The network identification integer of the target player.
25
+ * @param key - The unique identifier string for this player's metadata entry.
26
+ * @param value - The data payload to attach to the player.
27
+ * @param sync - Optional flag. If `true`, syncs this change to all other connected clients over the network.
28
+ */
29
+ setPlayerMeta(
30
+ playerId: number,
31
+ key: string,
32
+ value: any,
33
+ sync?: boolean,
34
+ ): void;
35
+
36
+ /**
37
+ * Retrieves a metadata value attached to a specific remote player.
38
+ * @template T - The expected type of the returned metadata value.
39
+ * @param playerId - The network identification integer of the target player.
40
+ * @param key - The unique identifier string of the player's metadata entry.
41
+ * @returns The stored metadata value cast to type T, or undefined if it does not exist.
42
+ */
43
+ getPlayerMeta<T = any>(playerId: number, key: string): T;
44
+
45
+ /**
46
+ * Sets a metadata value restricted or assigned specifically to the local player instance.
47
+ * @param key - The unique identifier string for the local player's metadata entry.
48
+ * @param value - The data payload to store.
49
+ * @param sync - Optional flag. If `true`, relays this local metadata state out to the server and other clients.
50
+ */
51
+ setLocalPlayerMeta(key: string, value: any, sync?: boolean): void;
52
+
53
+ /**
54
+ * Retrieves a metadata value attached specifically to the local player instance.
55
+ * @template T - The expected type of the returned metadata value.
56
+ * @param key - The unique identifier string of the local player's metadata entry.
57
+ * @returns The stored metadata value cast to type T, or undefined if it does not exist.
58
+ */
59
+ getLocalPlayerMeta<T = any>(key: string): T;
60
+
61
+ /**
62
+ * Attaches a metadata state payload to any synchronized network entity (e.g., vehicles, props, peds) using its network ID.
63
+ * @param netId - The network-assigned unique identifier tracking the target entity.
64
+ * @param key - The unique identifier string for the entity's metadata entry.
65
+ * @param value - The data payload to attach to the entity.
66
+ * @param sync - Optional flag. If `true`, synchronizes this entity metadata property to all clients tracking this object.
67
+ */
68
+ setEntityMeta(netId: number, key: string, value: any, sync?: boolean): void;
69
+
70
+ /**
71
+ * Retrieves a metadata value associated with a synchronized network entity.
72
+ * @template T - The expected type of the returned metadata value.
73
+ * @param netId - The network-assigned unique identifier tracking the target entity.
74
+ * @param key - The unique identifier string of the entity's metadata entry.
75
+ * @returns The stored metadata value cast to type T, or undefined if it does not exist.
76
+ */
77
+ getEntityMeta<T = any>(netId: number, key: string): T;
78
+ }