@nativewrappers/redm 0.0.49 → 0.0.51

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/Game.d.ts CHANGED
@@ -1,9 +1,4 @@
1
1
  import { Ped, Player } from "./entities";
2
- export declare class GameConstants {
3
- static readonly PlayerId: number;
4
- static readonly ServerId: number;
5
- static readonly Player: Player;
6
- }
7
2
  export declare class Game {
8
3
  static get PlayerPed(): Ped;
9
4
  static get Player(): Player;
package/Game.js CHANGED
@@ -1,15 +1,10 @@
1
- import { Ped, Player } from "./entities";
2
- // Constants that will never change throughout the lifetime of the player
3
- export class GameConstants {
4
- static PlayerId = PlayerId();
5
- static ServerId = GetPlayerServerId(GameConstants.PlayerId);
6
- static Player = new Player(GameConstants.PlayerId);
7
- }
1
+ import { Ped } from "./entities";
2
+ import { GameConstants } from "./GameConstants";
8
3
  export class Game {
9
4
  static get PlayerPed() {
10
5
  return new Ped(PlayerPedId());
11
6
  }
12
7
  static get Player() {
13
- return new Player(PlayerId());
8
+ return GameConstants.Player;
14
9
  }
15
10
  }
@@ -0,0 +1,7 @@
1
+ import { Player } from "./entities";
2
+ export declare class GameConstants {
3
+ private static player;
4
+ static readonly PlayerId: number;
5
+ static readonly ServerId: number;
6
+ static get Player(): Player;
7
+ }
@@ -0,0 +1,20 @@
1
+ import { Player } from "./entities";
2
+ // Constants that will never change throughout the lifetime of the player
3
+ export class GameConstants {
4
+ // the actual player object that will get initialized on the first call to the `get Player()`
5
+ static player = null;
6
+ // The player id of the local client
7
+ static PlayerId = PlayerId();
8
+ // The server id of the local client.
9
+ static ServerId = GetPlayerServerId(GameConstants.PlayerId);
10
+ // The player class of the local object
11
+ static get Player() {
12
+ // Initialize the player on first access, this should prevent any issues where the `Player` class isn't
13
+ // defined yet since we call this from `Player` too.
14
+ // return GameConstants.player;
15
+ if (GameConstants.player === null) {
16
+ GameConstants.player = new Player(GameConstants.PlayerId);
17
+ }
18
+ return GameConstants.player;
19
+ }
20
+ }
package/Model.d.ts ADDED
@@ -0,0 +1,96 @@
1
+ import { type Dimensions } from "./interfaces/Dimensions";
2
+ /**
3
+ * Class to create and manage entity models.
4
+ */
5
+ export declare class Model implements Disposable {
6
+ /**
7
+ * Hash of this model.
8
+ */
9
+ private hash;
10
+ private requestedModel;
11
+ /**
12
+ * Creates a model object based on the hash key or model string.
13
+ *
14
+ * @param hash A number or string of the model's hash. Example: "mp_m_freemode_01"
15
+ */
16
+ constructor(hash: number | string);
17
+ [Symbol.dispose](): void;
18
+ /**
19
+ * Gets the hash of the model.
20
+ *
21
+ * @returns The hash key.
22
+ */
23
+ get Hash(): number;
24
+ /**
25
+ * Gets if the model is valid or not.
26
+ *
27
+ * @returns Whether this model is valid.
28
+ */
29
+ get IsValid(): boolean;
30
+ /**
31
+ * Gets if the model is in cd image or not.
32
+ *
33
+ * @returns Whether this model is in cd image.
34
+ */
35
+ get IsInCdImage(): boolean;
36
+ /**
37
+ * Gets if the model is loaded or not.
38
+ *
39
+ * @returns Whether this model is loaded.
40
+ */
41
+ get IsLoaded(): boolean;
42
+ /**
43
+ * Gets if the model collision is loaded or not.
44
+ *
45
+ * @returns Whether this model collision is loaded.
46
+ */
47
+ get IsCollisionLoaded(): boolean;
48
+ /**
49
+ * Gets if the model is a boat or not.
50
+ *
51
+ * @returns Whether this model is a boat.
52
+ */
53
+ get IsBoat(): boolean;
54
+ /**
55
+ * Gets if the model is a Ped or not.
56
+ *
57
+ * @returns Whether this model is a Ped.
58
+ */
59
+ get IsPed(): boolean;
60
+ /**
61
+ * Gets if the model is a prop or not.
62
+ *
63
+ * @returns Whether this model is a prop.
64
+ */
65
+ get IsProp(): boolean;
66
+ /**
67
+ * Gets if the model is a train or not.
68
+ *
69
+ * @returns Whether this model is a train.
70
+ */
71
+ get IsTrain(): boolean;
72
+ /**
73
+ * Gets if the model is a Vehicle or not.
74
+ *
75
+ * @returns Whether this model is a Vehicle.
76
+ */
77
+ get IsVehicle(): boolean;
78
+ /**
79
+ * Gets the model dimensions.
80
+ *
81
+ * @returns This model min & max dimensions.
82
+ */
83
+ get Dimensions(): Dimensions;
84
+ /**
85
+ * Request and load the model with a specified timeout. Default timeout is 1000 (recommended).
86
+ * This function will not automatically set the model as no longer needed when
87
+ * done.
88
+ *
89
+ * @param timeoutMs Maximum allowed time for model to load.
90
+ */
91
+ request(timeoutMs?: number): Promise<boolean>;
92
+ /**
93
+ * Sets the model as no longer needed allowing the game engine to free memory.
94
+ */
95
+ markAsNoLongerNeeded(): void;
96
+ }
package/Model.js ADDED
@@ -0,0 +1,153 @@
1
+ import { Vector3 } from "../common/utils/Vector3";
2
+ import { Delay } from "../common/utils";
3
+ /**
4
+ * Class to create and manage entity models.
5
+ */
6
+ export class Model {
7
+ /**
8
+ * Hash of this model.
9
+ */
10
+ hash;
11
+ requestedModel = false;
12
+ /**
13
+ * Creates a model object based on the hash key or model string.
14
+ *
15
+ * @param hash A number or string of the model's hash. Example: "mp_m_freemode_01"
16
+ */
17
+ constructor(hash) {
18
+ if (typeof hash === "string") {
19
+ this.hash = GetHashKey(hash);
20
+ }
21
+ else {
22
+ this.hash = hash;
23
+ }
24
+ }
25
+ [Symbol.dispose]() {
26
+ if (this.requestedModel) {
27
+ this.markAsNoLongerNeeded();
28
+ }
29
+ }
30
+ /**
31
+ * Gets the hash of the model.
32
+ *
33
+ * @returns The hash key.
34
+ */
35
+ get Hash() {
36
+ return this.hash;
37
+ }
38
+ /**
39
+ * Gets if the model is valid or not.
40
+ *
41
+ * @returns Whether this model is valid.
42
+ */
43
+ get IsValid() {
44
+ return IsModelValid(this.hash);
45
+ }
46
+ /**
47
+ * Gets if the model is in cd image or not.
48
+ *
49
+ * @returns Whether this model is in cd image.
50
+ */
51
+ get IsInCdImage() {
52
+ return IsModelInCdimage(this.hash);
53
+ }
54
+ /**
55
+ * Gets if the model is loaded or not.
56
+ *
57
+ * @returns Whether this model is loaded.
58
+ */
59
+ get IsLoaded() {
60
+ return HasModelLoaded(this.hash);
61
+ }
62
+ /**
63
+ * Gets if the model collision is loaded or not.
64
+ *
65
+ * @returns Whether this model collision is loaded.
66
+ */
67
+ get IsCollisionLoaded() {
68
+ return HasCollisionForModelLoaded(this.hash);
69
+ }
70
+ /**
71
+ * Gets if the model is a boat or not.
72
+ *
73
+ * @returns Whether this model is a boat.
74
+ */
75
+ get IsBoat() {
76
+ return IsThisModelABoat(this.hash);
77
+ }
78
+ /**
79
+ * Gets if the model is a Ped or not.
80
+ *
81
+ * @returns Whether this model is a Ped.
82
+ */
83
+ get IsPed() {
84
+ return IsModelAPed(this.hash);
85
+ }
86
+ /**
87
+ * Gets if the model is a prop or not.
88
+ *
89
+ * @returns Whether this model is a prop.
90
+ */
91
+ get IsProp() {
92
+ return (this.IsValid &&
93
+ !this.IsPed &&
94
+ !this.IsVehicle &&
95
+ !IsWeaponValid(this.hash));
96
+ }
97
+ /**
98
+ * Gets if the model is a train or not.
99
+ *
100
+ * @returns Whether this model is a train.
101
+ */
102
+ get IsTrain() {
103
+ return IsThisModelATrain(this.hash);
104
+ }
105
+ /**
106
+ * Gets if the model is a Vehicle or not.
107
+ *
108
+ * @returns Whether this model is a Vehicle.
109
+ */
110
+ get IsVehicle() {
111
+ return IsModelAVehicle(this.hash);
112
+ }
113
+ /**
114
+ * Gets the model dimensions.
115
+ *
116
+ * @returns This model min & max dimensions.
117
+ */
118
+ get Dimensions() {
119
+ const [minArray, maxArray] = GetModelDimensions(this.hash);
120
+ const min = Vector3.fromArray(minArray);
121
+ const max = Vector3.fromArray(maxArray);
122
+ return { min, max };
123
+ }
124
+ /**
125
+ * Request and load the model with a specified timeout. Default timeout is 1000 (recommended).
126
+ * This function will not automatically set the model as no longer needed when
127
+ * done.
128
+ *
129
+ * @param timeoutMs Maximum allowed time for model to load.
130
+ */
131
+ async request(timeoutMs = 1000) {
132
+ if (!this.IsInCdImage && !this.IsValid && !IsWeaponValid(this.hash)) {
133
+ return false;
134
+ }
135
+ // pre-check so if its already loaded we don't add another ref
136
+ if (this.IsLoaded) {
137
+ return true;
138
+ }
139
+ RequestModel(this.hash, false);
140
+ const timeout = GetGameTimer() + timeoutMs;
141
+ while (!this.IsLoaded && GetGameTimer() < timeout) {
142
+ await Delay(0);
143
+ }
144
+ this.requestedModel = true;
145
+ return this.IsLoaded;
146
+ }
147
+ /**
148
+ * Sets the model as no longer needed allowing the game engine to free memory.
149
+ */
150
+ markAsNoLongerNeeded() {
151
+ SetModelAsNoLongerNeeded(this.hash);
152
+ }
153
+ }
@@ -0,0 +1,7 @@
1
+ import { RawKeys } from "./enums";
2
+ export declare class RawControls {
3
+ static IsKeyDown(rawKey: RawKeys): boolean;
4
+ static IsKeyPressed(rawKey: RawKeys): boolean;
5
+ static IsKeyReleased(rawKey: RawKeys): boolean;
6
+ static IsKeyUp(rawKey: RawKeys): boolean;
7
+ }
package/RawControls.js ADDED
@@ -0,0 +1,14 @@
1
+ export class RawControls {
2
+ static IsKeyDown(rawKey) {
3
+ return IsRawKeyDown(rawKey);
4
+ }
5
+ static IsKeyPressed(rawKey) {
6
+ return IsRawKeyPressed(rawKey);
7
+ }
8
+ static IsKeyReleased(rawKey) {
9
+ return IsRawKeyReleased(rawKey);
10
+ }
11
+ static IsKeyUp(rawKey) {
12
+ return IsRawKeyUp(rawKey);
13
+ }
14
+ }
@@ -1,7 +1,11 @@
1
1
  export declare class Player {
2
2
  private handle;
3
3
  static fromPedHandle(handle: number): Player;
4
- static fromServerId(serverId: number): Player;
4
+ /**
5
+ * Gets the player from the specified {@param serverId}
6
+ * @returns the player object, or null if the player didn't exist
7
+ */
8
+ static fromServerId(serverId: number): Player | null;
5
9
  /**
6
10
  * @param handle the player handle
7
11
  */
@@ -13,9 +17,5 @@ export declare class Player {
13
17
  */
14
18
  addStaminaUpgrade(amount: number): void;
15
19
  addHealthUpgrade(amount: number): void;
16
- /**
17
- * Doesn't seem to work :*
18
- * @param amount
19
- */
20
20
  addDeadeyeUpgrade(amount: number): void;
21
21
  }
@@ -1,9 +1,11 @@
1
+ import { GameConstants } from "../../redm/GameConstants";
1
2
  import { _N } from "../utils/Native";
2
3
  const handleUpgrade = (name, amount) => {
3
4
  const b1 = new ArrayBuffer(8 * 24);
4
5
  const a2 = new DataView(b1);
5
6
  const b2 = new ArrayBuffer(8 * 12);
6
7
  const a3 = new DataView(b2);
8
+ // _INVENTORY_ADD_ITEM_WITH_GUID
7
9
  _N("0xCB5D11F9508A928D", 1, a2, a3, GetHashKey(name), 1084182731, amount, 752097756);
8
10
  };
9
11
  export class Player {
@@ -11,8 +13,18 @@ export class Player {
11
13
  static fromPedHandle(handle) {
12
14
  return new Player(NetworkGetPlayerIndexFromPed(handle));
13
15
  }
16
+ /**
17
+ * Gets the player from the specified {@param serverId}
18
+ * @returns the player object, or null if the player didn't exist
19
+ */
14
20
  static fromServerId(serverId) {
15
- return new Player(GetPlayerFromServerId(serverId));
21
+ if (serverId === GameConstants.ServerId) {
22
+ return GameConstants.Player;
23
+ }
24
+ const player = GetPlayerFromServerId(serverId);
25
+ if (player === -1)
26
+ return null;
27
+ return new Player(player);
16
28
  }
17
29
  /**
18
30
  * @param handle the player handle
@@ -33,10 +45,6 @@ export class Player {
33
45
  addHealthUpgrade(amount) {
34
46
  handleUpgrade("UPGRADE_HEALTH_TANK_1", amount);
35
47
  }
36
- /**
37
- * Doesn't seem to work :*
38
- * @param amount
39
- */
40
48
  addDeadeyeUpgrade(amount) {
41
49
  handleUpgrade("UPGRADE_DEADEYE_TANK_1", amount);
42
50
  }
@@ -0,0 +1,3 @@
1
+ import { BaseEntity } from "./BaseEntity";
2
+ export declare class Prop extends BaseEntity {
3
+ }
@@ -0,0 +1,3 @@
1
+ import { BaseEntity } from "./BaseEntity";
2
+ export class Prop extends BaseEntity {
3
+ }
@@ -0,0 +1,230 @@
1
+ export declare enum RawKeys {
2
+ LeftMouseBtn = 1,//Left mouse button
3
+ RightMouseBtn = 2,//Right mouse button
4
+ CtrlBrkPrcs = 3,//Control-break processing
5
+ MidMouseBtn = 4,//Middle mouse button
6
+ ThumbForward = 5,//Thumb button back on mouse aka X1
7
+ ThumbBack = 6,//Thumb button forward on mouse aka X2
8
+ BackSpace = 8,//Backspace key
9
+ Tab = 9,//Tab key
10
+ Clear = 12,//Clear key
11
+ Enter = 13,//Enter or Return key
12
+ Shift = 16,//Shift key
13
+ Control = 17,//Ctrl key
14
+ Alt = 18,//Alt key
15
+ Pause = 19,//Pause key
16
+ CapsLock = 20,//Caps lock key
17
+ Kana = 21,//Kana input mode
18
+ Hangeul = 21,//Hangeul input mode
19
+ Hangul = 21,//Hangul input mode
20
+ Junju = 23,//Junja input method
21
+ Final = 24,//Final input method
22
+ Hanja = 25,//Hanja input method
23
+ Kanji = 25,//Kanji input method
24
+ Escape = 27,//Esc key
25
+ Convert = 28,//IME convert
26
+ NonConvert = 29,//IME Non convert
27
+ Accept = 30,//IME accept
28
+ ModeChange = 31,//IME mode change
29
+ Space = 32,//Space bar
30
+ PageUp = 33,//Page up key
31
+ PageDown = 34,//Page down key
32
+ End = 35,//End key
33
+ Home = 36,//Home key
34
+ LeftArrow = 37,//Left arrow key
35
+ UpArrow = 38,//Up arrow key
36
+ RightArrow = 39,//Right arrow key
37
+ DownArrow = 40,//Down arrow key
38
+ Select = 41,//Select key
39
+ Print = 42,//Print key
40
+ Execute = 43,//Execute key
41
+ PrintScreen = 44,//Print screen key
42
+ Inser = 45,//Insert key
43
+ Delete = 46,//Delete key
44
+ Help = 47,//Help key
45
+ Num0 = 48,//Top row 0 key (Matches '0')
46
+ Num1 = 49,//Top row 1 key (Matches '1')
47
+ Num2 = 50,//Top row 2 key (Matches '2')
48
+ Num3 = 51,//Top row 3 key (Matches '3')
49
+ Num4 = 52,//Top row 4 key (Matches '4')
50
+ Num5 = 53,//Top row 5 key (Matches '5')
51
+ Num6 = 54,//Top row 6 key (Matches '6')
52
+ Num7 = 55,//Top row 7 key (Matches '7')
53
+ Num8 = 56,//Top row 8 key (Matches '8')
54
+ Num9 = 57,//Top row 9 key (Matches '9')
55
+ A = 65,//A key (Matches 'A')
56
+ B = 66,//B key (Matches 'B')
57
+ C = 67,//C key (Matches 'C')
58
+ D = 68,//D key (Matches 'D')
59
+ E = 69,//E key (Matches 'E')
60
+ F = 70,//F key (Matches 'F')
61
+ G = 71,//G key (Matches 'G')
62
+ H = 72,//H key (Matches 'H')
63
+ I = 73,//I key (Matches 'I')
64
+ J = 74,//J key (Matches 'J')
65
+ K = 75,//K key (Matches 'K')
66
+ L = 76,//L key (Matches 'L')
67
+ M = 77,//M key (Matches 'M')
68
+ N = 78,//N key (Matches 'N')
69
+ O = 79,//O key (Matches 'O')
70
+ P = 80,//P key (Matches 'P')
71
+ Q = 81,//Q key (Matches 'Q')
72
+ R = 82,//R key (Matches 'R')
73
+ S = 83,//S key (Matches 'S')
74
+ T = 84,//T key (Matches 'T')
75
+ U = 85,//U key (Matches 'U')
76
+ V = 86,//V key (Matches 'V')
77
+ W = 87,//W key (Matches 'W')
78
+ X = 88,//X key (Matches 'X')
79
+ Y = 89,//Y key (Matches 'Y')
80
+ Z = 90,//Z key (Matches 'Z')
81
+ LeftWin = 91,//Left windows key
82
+ RightWin = 92,//Right windows key
83
+ Apps = 93,//Applications key
84
+ Sleep = 95,//Computer sleep key
85
+ Numpad0 = 96,//Numpad 0
86
+ Numpad1 = 97,//Numpad 1
87
+ Numpad2 = 98,//Numpad 2
88
+ Numpad3 = 99,//Numpad 3
89
+ Numpad4 = 100,//Numpad 4
90
+ Numpad5 = 101,//Numpad 5
91
+ Numpad6 = 102,//Numpad 6
92
+ Numpad7 = 103,//Numpad 7
93
+ Numpad8 = 104,//Numpad 8
94
+ Numpad9 = 105,//Numpad 9
95
+ Multiply = 106,//Multiply key
96
+ Add = 107,//Add key
97
+ Separator = 108,//Separator key
98
+ Subtract = 109,//Subtract key
99
+ Decimal = 110,//Decimal key
100
+ Divide = 111,//Divide key
101
+ F1 = 112,//F1
102
+ F2 = 113,//F2
103
+ F3 = 114,//F3
104
+ F4 = 115,//F4
105
+ F5 = 116,//F5
106
+ F6 = 117,//F6
107
+ F7 = 118,//F7
108
+ F8 = 119,//F8
109
+ F9 = 120,//F9
110
+ F10 = 121,//F10
111
+ F11 = 122,//F11
112
+ F12 = 123,//F12
113
+ F13 = 124,//F13
114
+ F14 = 125,//F14
115
+ F15 = 126,//F15
116
+ F16 = 127,//F16
117
+ F17 = 128,//F17
118
+ F18 = 129,//F18
119
+ F19 = 130,//F19
120
+ F20 = 131,//F20
121
+ F21 = 132,//F21
122
+ F22 = 133,//F22
123
+ F23 = 134,//F23
124
+ F24 = 135,//F24
125
+ NavigationView = 136,//reserved
126
+ NavigationMenu = 137,//reserved
127
+ NavigationUp = 138,//reserved
128
+ NavigationDown = 139,//reserved
129
+ NavigationLeft = 140,//reserved
130
+ NavigationRight = 141,//reserved
131
+ NavigationAccept = 142,//reserved
132
+ NavigationCancel = 143,//reserved
133
+ NumLock = 144,//Num lock key
134
+ ScrollLock = 145,//Scroll lock key
135
+ NumpadEqual = 146,//Numpad =
136
+ FJ_Jisho = 146,//Dictionary key
137
+ FJ_Masshou = 147,//Unregister word key
138
+ FJ_Touroku = 148,//Register word key
139
+ FJ_Loya = 149,//Left OYAYUBI key
140
+ FJ_Roya = 150,//Right OYAYUBI key
141
+ LeftShift = 160,//Left shift key
142
+ RightShift = 161,//Right shift key
143
+ LeftCtrl = 162,//Left control key
144
+ RightCtrl = 163,//Right control key
145
+ LeftMenu = 164,//Left menu key
146
+ RightMenu = 165,//Right menu
147
+ BrowserBack = 166,//Browser back button
148
+ BrowserForward = 167,//Browser forward button
149
+ BrowserRefresh = 168,//Browser refresh button
150
+ BrowserStop = 169,//Browser stop button
151
+ BrowserSearch = 170,//Browser search button
152
+ BrowserFavorites = 171,//Browser favorites button
153
+ BrowserHome = 172,//Browser home button
154
+ VolumeMute = 173,//Volume mute button
155
+ VolumeDown = 174,//Volume down button
156
+ VolumeUp = 175,//Volume up button
157
+ NextTrack = 176,//Next track media button
158
+ PrevTrack = 177,//Previous track media button
159
+ Stop = 178,//Stop media button
160
+ PlayPause = 179,//Play/pause media button
161
+ Mail = 180,//Launch mail button
162
+ MediaSelect = 181,//Launch media select button
163
+ App1 = 182,//Launch app 1 button
164
+ App2 = 183,//Launch app 2 button
165
+ OEM1 = 186,//;: key for US or misc keys for others
166
+ Plus = 187,//Plus key
167
+ Comma = 188,//Comma key
168
+ Minus = 189,//Minus key
169
+ Period = 190,//Period key
170
+ OEM2 = 191,//? for US or misc keys for others
171
+ OEM3 = 192,//~ for US or misc keys for others
172
+ Gamepad_A = 195,//Gamepad A button
173
+ Gamepad_B = 196,//Gamepad B button
174
+ Gamepad_X = 197,//Gamepad X button
175
+ Gamepad_Y = 198,//Gamepad Y button
176
+ GamepadRightBumper = 199,//Gamepad right bumper
177
+ GamepadLeftBumper = 200,//Gamepad left bumper
178
+ GamepadLeftTrigger = 201,//Gamepad left trigger
179
+ GamepadRightTrigger = 202,//Gamepad right trigger
180
+ GamepadDPadUp = 203,//Gamepad DPad up
181
+ GamepadDPadDown = 204,//Gamepad DPad down
182
+ GamepadDPadLeft = 205,//Gamepad DPad left
183
+ GamepadDPadRight = 206,//Gamepad DPad right
184
+ GamepadMenu = 207,//Gamepad menu button
185
+ GamepadView = 208,//Gamepad view button
186
+ GamepadLeftStickBtn = 209,//Gamepad left stick button
187
+ GamepadRightStickBtn = 210,//Gamepad right stick button
188
+ GamepadLeftStickUp = 211,//Gamepad left stick up
189
+ GamepadLeftStickDown = 212,//Gamepad left stick down
190
+ GamepadLeftStickRight = 213,//Gamepad left stick right
191
+ GamepadLeftStickLeft = 214,//Gamepad left stick left
192
+ GamepadRightStickUp = 215,//Gamepad right stick up
193
+ GamepadRightStickDown = 216,//Gamepad right stick down
194
+ GamepadRightStickRight = 217,//Gamepad right stick right
195
+ GamepadRightStickLeft = 218,//Gamepad right stick left
196
+ OEM4 = 219,//[ for US or misc keys for others
197
+ OEM5 = 220,//\ for US or misc keys for others
198
+ OEM6 = 221,//] for US or misc keys for others
199
+ OEM7 = 222,//' for US or misc keys for others
200
+ OEM8 = 223,//Misc keys for others
201
+ OEMAX = 225,//AX key on Japanese AX keyboard
202
+ OEM102 = 226,//"<>" or "\|" on RT 102-key keyboard
203
+ ICOHelp = 227,//Help key on ICO
204
+ ICO00 = 228,//00 key on ICO
205
+ ProcessKey = 229,//Process key input method
206
+ OEMCLEAR = 230,//OEM specific
207
+ Packet = 231,//IDK man try to google it
208
+ OEMReset = 233,//OEM reset button
209
+ OEMJump = 234,//OEM jump button
210
+ OEMPA1 = 235,//OEM PA1 button
211
+ OEMPA2 = 236,//OEM PA2 button
212
+ OEMPA3 = 237,//OEM PA3 button
213
+ OEMWSCtrl = 238,//OEM WS Control button
214
+ OEMCusel = 239,//OEM CUSEL button
215
+ OEMAttn = 240,//OEM ATTN button
216
+ OEMFinish = 241,//OEM finish button
217
+ OEMCopy = 242,//OEM copy button
218
+ OEMAuto = 243,//OEM auto button
219
+ OEMEnlw = 244,//OEM ENLW
220
+ OEMBackTab = 245,//OEM back tab
221
+ Attn = 246,//Attn
222
+ CrSel = 247,//CrSel
223
+ ExSel = 248,//ExSel
224
+ EraseEOF = 249,//Erase EOF key
225
+ Play = 250,//Play key
226
+ Zoom = 251,//Zoom key
227
+ NoName = 252,//No name
228
+ PA1 = 253,//PA1 key
229
+ OEMClear = 254
230
+ }
@@ -0,0 +1,246 @@
1
+ // sauce
2
+ // https://gist.github.com/Nordaj/cc6cadcbee1019a3299939d0f1b86296
3
+ export var RawKeys;
4
+ (function (RawKeys) {
5
+ RawKeys[RawKeys["LeftMouseBtn"] = 1] = "LeftMouseBtn";
6
+ RawKeys[RawKeys["RightMouseBtn"] = 2] = "RightMouseBtn";
7
+ RawKeys[RawKeys["CtrlBrkPrcs"] = 3] = "CtrlBrkPrcs";
8
+ RawKeys[RawKeys["MidMouseBtn"] = 4] = "MidMouseBtn";
9
+ RawKeys[RawKeys["ThumbForward"] = 5] = "ThumbForward";
10
+ RawKeys[RawKeys["ThumbBack"] = 6] = "ThumbBack";
11
+ //0x07 : reserved
12
+ RawKeys[RawKeys["BackSpace"] = 8] = "BackSpace";
13
+ RawKeys[RawKeys["Tab"] = 9] = "Tab";
14
+ //0x0A - 0x0B : reserved
15
+ RawKeys[RawKeys["Clear"] = 12] = "Clear";
16
+ RawKeys[RawKeys["Enter"] = 13] = "Enter";
17
+ //0x0E - 0x0F : unassigned
18
+ RawKeys[RawKeys["Shift"] = 16] = "Shift";
19
+ RawKeys[RawKeys["Control"] = 17] = "Control";
20
+ RawKeys[RawKeys["Alt"] = 18] = "Alt";
21
+ RawKeys[RawKeys["Pause"] = 19] = "Pause";
22
+ RawKeys[RawKeys["CapsLock"] = 20] = "CapsLock";
23
+ RawKeys[RawKeys["Kana"] = 21] = "Kana";
24
+ RawKeys[RawKeys["Hangeul"] = 21] = "Hangeul";
25
+ RawKeys[RawKeys["Hangul"] = 21] = "Hangul";
26
+ //0x16 : unassigned
27
+ RawKeys[RawKeys["Junju"] = 23] = "Junju";
28
+ RawKeys[RawKeys["Final"] = 24] = "Final";
29
+ RawKeys[RawKeys["Hanja"] = 25] = "Hanja";
30
+ RawKeys[RawKeys["Kanji"] = 25] = "Kanji";
31
+ //0x1A : unassigned
32
+ RawKeys[RawKeys["Escape"] = 27] = "Escape";
33
+ RawKeys[RawKeys["Convert"] = 28] = "Convert";
34
+ RawKeys[RawKeys["NonConvert"] = 29] = "NonConvert";
35
+ RawKeys[RawKeys["Accept"] = 30] = "Accept";
36
+ RawKeys[RawKeys["ModeChange"] = 31] = "ModeChange";
37
+ RawKeys[RawKeys["Space"] = 32] = "Space";
38
+ RawKeys[RawKeys["PageUp"] = 33] = "PageUp";
39
+ RawKeys[RawKeys["PageDown"] = 34] = "PageDown";
40
+ RawKeys[RawKeys["End"] = 35] = "End";
41
+ RawKeys[RawKeys["Home"] = 36] = "Home";
42
+ RawKeys[RawKeys["LeftArrow"] = 37] = "LeftArrow";
43
+ RawKeys[RawKeys["UpArrow"] = 38] = "UpArrow";
44
+ RawKeys[RawKeys["RightArrow"] = 39] = "RightArrow";
45
+ RawKeys[RawKeys["DownArrow"] = 40] = "DownArrow";
46
+ RawKeys[RawKeys["Select"] = 41] = "Select";
47
+ RawKeys[RawKeys["Print"] = 42] = "Print";
48
+ RawKeys[RawKeys["Execute"] = 43] = "Execute";
49
+ RawKeys[RawKeys["PrintScreen"] = 44] = "PrintScreen";
50
+ RawKeys[RawKeys["Inser"] = 45] = "Inser";
51
+ RawKeys[RawKeys["Delete"] = 46] = "Delete";
52
+ RawKeys[RawKeys["Help"] = 47] = "Help";
53
+ RawKeys[RawKeys["Num0"] = 48] = "Num0";
54
+ RawKeys[RawKeys["Num1"] = 49] = "Num1";
55
+ RawKeys[RawKeys["Num2"] = 50] = "Num2";
56
+ RawKeys[RawKeys["Num3"] = 51] = "Num3";
57
+ RawKeys[RawKeys["Num4"] = 52] = "Num4";
58
+ RawKeys[RawKeys["Num5"] = 53] = "Num5";
59
+ RawKeys[RawKeys["Num6"] = 54] = "Num6";
60
+ RawKeys[RawKeys["Num7"] = 55] = "Num7";
61
+ RawKeys[RawKeys["Num8"] = 56] = "Num8";
62
+ RawKeys[RawKeys["Num9"] = 57] = "Num9";
63
+ //0x3A - 0x40 : unassigned
64
+ RawKeys[RawKeys["A"] = 65] = "A";
65
+ RawKeys[RawKeys["B"] = 66] = "B";
66
+ RawKeys[RawKeys["C"] = 67] = "C";
67
+ RawKeys[RawKeys["D"] = 68] = "D";
68
+ RawKeys[RawKeys["E"] = 69] = "E";
69
+ RawKeys[RawKeys["F"] = 70] = "F";
70
+ RawKeys[RawKeys["G"] = 71] = "G";
71
+ RawKeys[RawKeys["H"] = 72] = "H";
72
+ RawKeys[RawKeys["I"] = 73] = "I";
73
+ RawKeys[RawKeys["J"] = 74] = "J";
74
+ RawKeys[RawKeys["K"] = 75] = "K";
75
+ RawKeys[RawKeys["L"] = 76] = "L";
76
+ RawKeys[RawKeys["M"] = 77] = "M";
77
+ RawKeys[RawKeys["N"] = 78] = "N";
78
+ RawKeys[RawKeys["O"] = 79] = "O";
79
+ RawKeys[RawKeys["P"] = 80] = "P";
80
+ RawKeys[RawKeys["Q"] = 81] = "Q";
81
+ RawKeys[RawKeys["R"] = 82] = "R";
82
+ RawKeys[RawKeys["S"] = 83] = "S";
83
+ RawKeys[RawKeys["T"] = 84] = "T";
84
+ RawKeys[RawKeys["U"] = 85] = "U";
85
+ RawKeys[RawKeys["V"] = 86] = "V";
86
+ RawKeys[RawKeys["W"] = 87] = "W";
87
+ RawKeys[RawKeys["X"] = 88] = "X";
88
+ RawKeys[RawKeys["Y"] = 89] = "Y";
89
+ RawKeys[RawKeys["Z"] = 90] = "Z";
90
+ RawKeys[RawKeys["LeftWin"] = 91] = "LeftWin";
91
+ RawKeys[RawKeys["RightWin"] = 92] = "RightWin";
92
+ RawKeys[RawKeys["Apps"] = 93] = "Apps";
93
+ //0x5E : reserved
94
+ RawKeys[RawKeys["Sleep"] = 95] = "Sleep";
95
+ RawKeys[RawKeys["Numpad0"] = 96] = "Numpad0";
96
+ RawKeys[RawKeys["Numpad1"] = 97] = "Numpad1";
97
+ RawKeys[RawKeys["Numpad2"] = 98] = "Numpad2";
98
+ RawKeys[RawKeys["Numpad3"] = 99] = "Numpad3";
99
+ RawKeys[RawKeys["Numpad4"] = 100] = "Numpad4";
100
+ RawKeys[RawKeys["Numpad5"] = 101] = "Numpad5";
101
+ RawKeys[RawKeys["Numpad6"] = 102] = "Numpad6";
102
+ RawKeys[RawKeys["Numpad7"] = 103] = "Numpad7";
103
+ RawKeys[RawKeys["Numpad8"] = 104] = "Numpad8";
104
+ RawKeys[RawKeys["Numpad9"] = 105] = "Numpad9";
105
+ RawKeys[RawKeys["Multiply"] = 106] = "Multiply";
106
+ RawKeys[RawKeys["Add"] = 107] = "Add";
107
+ RawKeys[RawKeys["Separator"] = 108] = "Separator";
108
+ RawKeys[RawKeys["Subtract"] = 109] = "Subtract";
109
+ RawKeys[RawKeys["Decimal"] = 110] = "Decimal";
110
+ RawKeys[RawKeys["Divide"] = 111] = "Divide";
111
+ RawKeys[RawKeys["F1"] = 112] = "F1";
112
+ RawKeys[RawKeys["F2"] = 113] = "F2";
113
+ RawKeys[RawKeys["F3"] = 114] = "F3";
114
+ RawKeys[RawKeys["F4"] = 115] = "F4";
115
+ RawKeys[RawKeys["F5"] = 116] = "F5";
116
+ RawKeys[RawKeys["F6"] = 117] = "F6";
117
+ RawKeys[RawKeys["F7"] = 118] = "F7";
118
+ RawKeys[RawKeys["F8"] = 119] = "F8";
119
+ RawKeys[RawKeys["F9"] = 120] = "F9";
120
+ RawKeys[RawKeys["F10"] = 121] = "F10";
121
+ RawKeys[RawKeys["F11"] = 122] = "F11";
122
+ RawKeys[RawKeys["F12"] = 123] = "F12";
123
+ RawKeys[RawKeys["F13"] = 124] = "F13";
124
+ RawKeys[RawKeys["F14"] = 125] = "F14";
125
+ RawKeys[RawKeys["F15"] = 126] = "F15";
126
+ RawKeys[RawKeys["F16"] = 127] = "F16";
127
+ RawKeys[RawKeys["F17"] = 128] = "F17";
128
+ RawKeys[RawKeys["F18"] = 129] = "F18";
129
+ RawKeys[RawKeys["F19"] = 130] = "F19";
130
+ RawKeys[RawKeys["F20"] = 131] = "F20";
131
+ RawKeys[RawKeys["F21"] = 132] = "F21";
132
+ RawKeys[RawKeys["F22"] = 133] = "F22";
133
+ RawKeys[RawKeys["F23"] = 134] = "F23";
134
+ RawKeys[RawKeys["F24"] = 135] = "F24";
135
+ //0x88 - 0x8F : UI navigation
136
+ RawKeys[RawKeys["NavigationView"] = 136] = "NavigationView";
137
+ RawKeys[RawKeys["NavigationMenu"] = 137] = "NavigationMenu";
138
+ RawKeys[RawKeys["NavigationUp"] = 138] = "NavigationUp";
139
+ RawKeys[RawKeys["NavigationDown"] = 139] = "NavigationDown";
140
+ RawKeys[RawKeys["NavigationLeft"] = 140] = "NavigationLeft";
141
+ RawKeys[RawKeys["NavigationRight"] = 141] = "NavigationRight";
142
+ RawKeys[RawKeys["NavigationAccept"] = 142] = "NavigationAccept";
143
+ RawKeys[RawKeys["NavigationCancel"] = 143] = "NavigationCancel";
144
+ RawKeys[RawKeys["NumLock"] = 144] = "NumLock";
145
+ RawKeys[RawKeys["ScrollLock"] = 145] = "ScrollLock";
146
+ RawKeys[RawKeys["NumpadEqual"] = 146] = "NumpadEqual";
147
+ RawKeys[RawKeys["FJ_Jisho"] = 146] = "FJ_Jisho";
148
+ RawKeys[RawKeys["FJ_Masshou"] = 147] = "FJ_Masshou";
149
+ RawKeys[RawKeys["FJ_Touroku"] = 148] = "FJ_Touroku";
150
+ RawKeys[RawKeys["FJ_Loya"] = 149] = "FJ_Loya";
151
+ RawKeys[RawKeys["FJ_Roya"] = 150] = "FJ_Roya";
152
+ //0x97 - 0x9F : unassigned
153
+ RawKeys[RawKeys["LeftShift"] = 160] = "LeftShift";
154
+ RawKeys[RawKeys["RightShift"] = 161] = "RightShift";
155
+ RawKeys[RawKeys["LeftCtrl"] = 162] = "LeftCtrl";
156
+ RawKeys[RawKeys["RightCtrl"] = 163] = "RightCtrl";
157
+ RawKeys[RawKeys["LeftMenu"] = 164] = "LeftMenu";
158
+ RawKeys[RawKeys["RightMenu"] = 165] = "RightMenu";
159
+ RawKeys[RawKeys["BrowserBack"] = 166] = "BrowserBack";
160
+ RawKeys[RawKeys["BrowserForward"] = 167] = "BrowserForward";
161
+ RawKeys[RawKeys["BrowserRefresh"] = 168] = "BrowserRefresh";
162
+ RawKeys[RawKeys["BrowserStop"] = 169] = "BrowserStop";
163
+ RawKeys[RawKeys["BrowserSearch"] = 170] = "BrowserSearch";
164
+ RawKeys[RawKeys["BrowserFavorites"] = 171] = "BrowserFavorites";
165
+ RawKeys[RawKeys["BrowserHome"] = 172] = "BrowserHome";
166
+ RawKeys[RawKeys["VolumeMute"] = 173] = "VolumeMute";
167
+ RawKeys[RawKeys["VolumeDown"] = 174] = "VolumeDown";
168
+ RawKeys[RawKeys["VolumeUp"] = 175] = "VolumeUp";
169
+ RawKeys[RawKeys["NextTrack"] = 176] = "NextTrack";
170
+ RawKeys[RawKeys["PrevTrack"] = 177] = "PrevTrack";
171
+ RawKeys[RawKeys["Stop"] = 178] = "Stop";
172
+ RawKeys[RawKeys["PlayPause"] = 179] = "PlayPause";
173
+ RawKeys[RawKeys["Mail"] = 180] = "Mail";
174
+ RawKeys[RawKeys["MediaSelect"] = 181] = "MediaSelect";
175
+ RawKeys[RawKeys["App1"] = 182] = "App1";
176
+ RawKeys[RawKeys["App2"] = 183] = "App2";
177
+ //0xB8 - 0xB9 : reserved
178
+ RawKeys[RawKeys["OEM1"] = 186] = "OEM1";
179
+ RawKeys[RawKeys["Plus"] = 187] = "Plus";
180
+ RawKeys[RawKeys["Comma"] = 188] = "Comma";
181
+ RawKeys[RawKeys["Minus"] = 189] = "Minus";
182
+ RawKeys[RawKeys["Period"] = 190] = "Period";
183
+ RawKeys[RawKeys["OEM2"] = 191] = "OEM2";
184
+ RawKeys[RawKeys["OEM3"] = 192] = "OEM3";
185
+ //0xC1 - 0xC2 : reserved
186
+ RawKeys[RawKeys["Gamepad_A"] = 195] = "Gamepad_A";
187
+ RawKeys[RawKeys["Gamepad_B"] = 196] = "Gamepad_B";
188
+ RawKeys[RawKeys["Gamepad_X"] = 197] = "Gamepad_X";
189
+ RawKeys[RawKeys["Gamepad_Y"] = 198] = "Gamepad_Y";
190
+ RawKeys[RawKeys["GamepadRightBumper"] = 199] = "GamepadRightBumper";
191
+ RawKeys[RawKeys["GamepadLeftBumper"] = 200] = "GamepadLeftBumper";
192
+ RawKeys[RawKeys["GamepadLeftTrigger"] = 201] = "GamepadLeftTrigger";
193
+ RawKeys[RawKeys["GamepadRightTrigger"] = 202] = "GamepadRightTrigger";
194
+ RawKeys[RawKeys["GamepadDPadUp"] = 203] = "GamepadDPadUp";
195
+ RawKeys[RawKeys["GamepadDPadDown"] = 204] = "GamepadDPadDown";
196
+ RawKeys[RawKeys["GamepadDPadLeft"] = 205] = "GamepadDPadLeft";
197
+ RawKeys[RawKeys["GamepadDPadRight"] = 206] = "GamepadDPadRight";
198
+ RawKeys[RawKeys["GamepadMenu"] = 207] = "GamepadMenu";
199
+ RawKeys[RawKeys["GamepadView"] = 208] = "GamepadView";
200
+ RawKeys[RawKeys["GamepadLeftStickBtn"] = 209] = "GamepadLeftStickBtn";
201
+ RawKeys[RawKeys["GamepadRightStickBtn"] = 210] = "GamepadRightStickBtn";
202
+ RawKeys[RawKeys["GamepadLeftStickUp"] = 211] = "GamepadLeftStickUp";
203
+ RawKeys[RawKeys["GamepadLeftStickDown"] = 212] = "GamepadLeftStickDown";
204
+ RawKeys[RawKeys["GamepadLeftStickRight"] = 213] = "GamepadLeftStickRight";
205
+ RawKeys[RawKeys["GamepadLeftStickLeft"] = 214] = "GamepadLeftStickLeft";
206
+ RawKeys[RawKeys["GamepadRightStickUp"] = 215] = "GamepadRightStickUp";
207
+ RawKeys[RawKeys["GamepadRightStickDown"] = 216] = "GamepadRightStickDown";
208
+ RawKeys[RawKeys["GamepadRightStickRight"] = 217] = "GamepadRightStickRight";
209
+ RawKeys[RawKeys["GamepadRightStickLeft"] = 218] = "GamepadRightStickLeft";
210
+ RawKeys[RawKeys["OEM4"] = 219] = "OEM4";
211
+ RawKeys[RawKeys["OEM5"] = 220] = "OEM5";
212
+ RawKeys[RawKeys["OEM6"] = 221] = "OEM6";
213
+ RawKeys[RawKeys["OEM7"] = 222] = "OEM7";
214
+ RawKeys[RawKeys["OEM8"] = 223] = "OEM8";
215
+ //0xE0 : reserved
216
+ RawKeys[RawKeys["OEMAX"] = 225] = "OEMAX";
217
+ RawKeys[RawKeys["OEM102"] = 226] = "OEM102";
218
+ RawKeys[RawKeys["ICOHelp"] = 227] = "ICOHelp";
219
+ RawKeys[RawKeys["ICO00"] = 228] = "ICO00";
220
+ RawKeys[RawKeys["ProcessKey"] = 229] = "ProcessKey";
221
+ RawKeys[RawKeys["OEMCLEAR"] = 230] = "OEMCLEAR";
222
+ RawKeys[RawKeys["Packet"] = 231] = "Packet";
223
+ //0xE8 : unassigned
224
+ RawKeys[RawKeys["OEMReset"] = 233] = "OEMReset";
225
+ RawKeys[RawKeys["OEMJump"] = 234] = "OEMJump";
226
+ RawKeys[RawKeys["OEMPA1"] = 235] = "OEMPA1";
227
+ RawKeys[RawKeys["OEMPA2"] = 236] = "OEMPA2";
228
+ RawKeys[RawKeys["OEMPA3"] = 237] = "OEMPA3";
229
+ RawKeys[RawKeys["OEMWSCtrl"] = 238] = "OEMWSCtrl";
230
+ RawKeys[RawKeys["OEMCusel"] = 239] = "OEMCusel";
231
+ RawKeys[RawKeys["OEMAttn"] = 240] = "OEMAttn";
232
+ RawKeys[RawKeys["OEMFinish"] = 241] = "OEMFinish";
233
+ RawKeys[RawKeys["OEMCopy"] = 242] = "OEMCopy";
234
+ RawKeys[RawKeys["OEMAuto"] = 243] = "OEMAuto";
235
+ RawKeys[RawKeys["OEMEnlw"] = 244] = "OEMEnlw";
236
+ RawKeys[RawKeys["OEMBackTab"] = 245] = "OEMBackTab";
237
+ RawKeys[RawKeys["Attn"] = 246] = "Attn";
238
+ RawKeys[RawKeys["CrSel"] = 247] = "CrSel";
239
+ RawKeys[RawKeys["ExSel"] = 248] = "ExSel";
240
+ RawKeys[RawKeys["EraseEOF"] = 249] = "EraseEOF";
241
+ RawKeys[RawKeys["Play"] = 250] = "Play";
242
+ RawKeys[RawKeys["Zoom"] = 251] = "Zoom";
243
+ RawKeys[RawKeys["NoName"] = 252] = "NoName";
244
+ RawKeys[RawKeys["PA1"] = 253] = "PA1";
245
+ RawKeys[RawKeys["OEMClear"] = 254] = "OEMClear";
246
+ })(RawKeys || (RawKeys = {}));
package/enums/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from "./Ped";
3
3
  export * from "./Relationship";
4
4
  export * from "./VehicleSeat";
5
5
  export * from "./Keys";
6
+ export * from "./RawKeys";
package/enums/index.js CHANGED
@@ -3,3 +3,4 @@ export * from "./Ped";
3
3
  export * from "./Relationship";
4
4
  export * from "./VehicleSeat";
5
5
  export * from "./Keys";
6
+ export * from "./RawKeys";
File without changes
package/game/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";
package/index.d.ts CHANGED
@@ -3,5 +3,7 @@ export * from "./enums/index";
3
3
  export * from "./Volume";
4
4
  export * from "./Controls";
5
5
  export * from "./Game";
6
+ export * from "./world";
7
+ export * from "./GameConstants";
6
8
  export * from "./RelationshipGroup";
7
9
  export * from "./Attribute";
package/index.js CHANGED
@@ -3,5 +3,7 @@ export * from "./enums/index";
3
3
  export * from "./Volume";
4
4
  export * from "./Controls";
5
5
  export * from "./Game";
6
+ export * from "./world";
7
+ export * from "./GameConstants";
6
8
  export * from "./RelationshipGroup";
7
9
  export * from "./Attribute";
@@ -0,0 +1,5 @@
1
+ import { Vector3 } from "../../common/utils/Vector3";
2
+ export interface Dimensions {
3
+ min: Vector3;
4
+ max: Vector3;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "Remco Troost <d0p3t>",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "version": "0.0.49",
7
+ "version": "0.0.51",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/nativewrappers/fivem.git"
@@ -28,6 +28,6 @@
28
28
  ".": "./index.js"
29
29
  },
30
30
  "dependencies": {
31
- "@nativewrappers/common": "0.0.49"
31
+ "@nativewrappers/common": "0.0.51"
32
32
  }
33
33
  }
@@ -0,0 +1,7 @@
1
+ import { Vector3 } from "../../common/utils";
2
+ import { Vehicle } from "../../redm/entities";
3
+ import { Model } from "../../redm/Model";
4
+ /**
5
+ * Creates a vehicle at the specified {@param spawnPos}, you don't need to request the model before this.
6
+ */
7
+ export declare function createDraftVehicle(model: Model, spawnPos: Vector3, heading: number, isNetwork?: boolean, bScriptHostVeh?: boolean, bDontAutoCreateDraftAnimals?: boolean, draftAnimalPopGroup?: number, p9?: boolean): Promise<Vehicle | null>;
@@ -0,0 +1,17 @@
1
+ import { Vehicle } from "../../redm/entities";
2
+ import { _N } from "../../redm/utils";
3
+ /**
4
+ * Creates a vehicle at the specified {@param spawnPos}, you don't need to request the model before this.
5
+ */
6
+ export async function createDraftVehicle(model, spawnPos, heading, isNetwork = false, bScriptHostVeh = true, bDontAutoCreateDraftAnimals = true, draftAnimalPopGroup = 0, p9 = true) {
7
+ if (!model.IsPed || !model.request(1000)) {
8
+ return null;
9
+ }
10
+ const draftVehHandle = _N("0x214651FB1DFEBA89", model.Hash, spawnPos.x, spawnPos.y, spawnPos.z, heading, isNetwork, bScriptHostVeh, bDontAutoCreateDraftAnimals, draftAnimalPopGroup, p9, Citizen.resultAsInteger());
11
+ if (draftVehHandle !== 0) {
12
+ model.markAsNoLongerNeeded();
13
+ return new Vehicle(draftVehHandle);
14
+ }
15
+ // Veh handle was 0, we have no veh :(
16
+ return null;
17
+ }
@@ -0,0 +1,7 @@
1
+ import { Vector3 } from "../../common/utils";
2
+ import { Ped } from "../../redm/entities";
3
+ import { Model } from "../../redm/Model";
4
+ /**
5
+ * Creates a ped at the specified {@param spawnPos}, you don't need to request the model before this.
6
+ */
7
+ export declare function createPed(model: Model, spawnPos: Vector3, heading: number, isNetwork?: boolean, bScriptHostPed?: boolean, p7?: boolean, p8?: boolean): Promise<Ped | null>;
@@ -0,0 +1,16 @@
1
+ import { Ped } from "../../redm/entities";
2
+ /**
3
+ * Creates a ped at the specified {@param spawnPos}, you don't need to request the model before this.
4
+ */
5
+ export async function createPed(model, spawnPos, heading, isNetwork = false, bScriptHostPed = true, p7 = true, p8 = true) {
6
+ if (!model.IsPed || !model.request(1000)) {
7
+ return null;
8
+ }
9
+ const pedHandle = CreatePed(model.Hash, spawnPos.x, spawnPos.y, spawnPos.z, heading, isNetwork, bScriptHostPed, p7, p8);
10
+ if (pedHandle !== 0) {
11
+ model.markAsNoLongerNeeded();
12
+ return new Ped(pedHandle);
13
+ }
14
+ // Ped handle was 0, we have no ped :(
15
+ return null;
16
+ }
@@ -0,0 +1,7 @@
1
+ import { Vector3 } from "../../common/utils";
2
+ import { Prop } from "../../redm/entities/Prop";
3
+ import { Model } from "../../redm/Model";
4
+ /**
5
+ * Creates a ped at the specified {@param spawnPos}, you don't need to request the model before this.
6
+ */
7
+ export declare function createProp(model: Model, spawnPos: Vector3, heading: number, isNetwork?: boolean, bScriptHostProp?: boolean, dynamic?: boolean, p7?: boolean, p8?: boolean): Promise<Prop | null>;
@@ -0,0 +1,16 @@
1
+ import { Prop } from "../../redm/entities/Prop";
2
+ /**
3
+ * Creates a ped at the specified {@param spawnPos}, you don't need to request the model before this.
4
+ */
5
+ export async function createProp(model, spawnPos, heading, isNetwork = false, bScriptHostProp = true, dynamic = true, p7 = true, p8 = true) {
6
+ if (!model.IsProp || !model.request(1000)) {
7
+ return null;
8
+ }
9
+ const propHandle = CreateObject(model.Hash, spawnPos.x, spawnPos.y, spawnPos.z, isNetwork, bScriptHostProp, dynamic, p7, p8);
10
+ if (propHandle !== 0) {
11
+ model.markAsNoLongerNeeded();
12
+ return new Prop(propHandle);
13
+ }
14
+ // prop handle was 0, we have no prop :(
15
+ return null;
16
+ }
@@ -0,0 +1,7 @@
1
+ import { Vector3 } from "../../common/utils";
2
+ import { Vehicle } from "../../redm/entities";
3
+ import { Model } from "../../redm/Model";
4
+ /**
5
+ * Creates a vehicle at the specified {@param spawnPos}, you don't need to request the model before this.
6
+ */
7
+ export declare function createVehicle(model: Model, spawnPos: Vector3, heading: number, isNetwork?: boolean, bScriptHostVeh?: boolean, bDontAutoCreateDraftAnimals?: boolean, p8?: boolean): Promise<Vehicle | null>;
@@ -0,0 +1,16 @@
1
+ import { Vehicle } from "../../redm/entities";
2
+ /**
3
+ * Creates a vehicle at the specified {@param spawnPos}, you don't need to request the model before this.
4
+ */
5
+ export async function createVehicle(model, spawnPos, heading, isNetwork = false, bScriptHostVeh = true, bDontAutoCreateDraftAnimals = true, p8 = true) {
6
+ if (!model.IsPed || !model.request(1000)) {
7
+ return null;
8
+ }
9
+ const pedHandle = CreateVehicle(model.Hash, spawnPos.x, spawnPos.y, spawnPos.z, heading, isNetwork, bScriptHostVeh, bDontAutoCreateDraftAnimals, p8);
10
+ if (pedHandle !== 0) {
11
+ model.markAsNoLongerNeeded();
12
+ return new Vehicle(pedHandle);
13
+ }
14
+ // Ped handle was 0, we have no ped :(
15
+ return null;
16
+ }
@@ -0,0 +1,4 @@
1
+ export { createPed } from "./createPed";
2
+ export { createProp } from "./createProp";
3
+ export { createVehicle } from "./createVehicle";
4
+ export { createDraftVehicle } from "./createDraftVehicle";
package/world/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { createPed } from "./createPed";
2
+ export { createProp } from "./createProp";
3
+ export { createVehicle } from "./createVehicle";
4
+ export { createDraftVehicle } from "./createDraftVehicle";