@nativewrappers/redm 0.0.90 → 0.0.93

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/entities/Ped.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import type { Vector3 } from "../common/utils/Vector";
2
2
  import { Tasks } from "../Task";
3
+ import { ItemAddReason } from "../inventory/InventoryTypes";
4
+ import type { AmmoModel } from "../models/AmmoModel";
5
+ import type { WeaponModel } from "../models/WeaponModel";
3
6
  import { Attributes } from "../Attribute";
4
7
  import type { KnockOffVehicle, TamingState, eDamageCleanliness } from "../enums/Ped";
5
8
  import type { VehicleSeat } from "../enums/VehicleSeat";
@@ -9,7 +12,22 @@ import { Vehicle } from "./Vehicle";
9
12
  export declare class Ped extends BaseEntity {
10
13
  private attributes;
11
14
  private tasks;
15
+ /**
16
+ * Gets the entity from the handle given, if the entity doesn't exist it will return
17
+ * null.
18
+ */
19
+ static fromHandle(handle: number): Ped | null;
20
+ /**
21
+ * Gets the ped from the current network id, this doesn't check that
22
+ * the entity is actually a ped
23
+ */
24
+ static fromNetworkId(netId: number): Ped | null;
25
+ static fromStateBagName(bagName: string): Ped | null;
12
26
  constructor(handle: number);
27
+ /**
28
+ * @returns the current horse or vehicle the ped is on, or null if they're not on either
29
+ */
30
+ get MountedEntity(): BaseEntity | null;
13
31
  /**
14
32
  * Blocks scenarios inbetween the specified vectors
15
33
  * @todo Move to Game
@@ -52,6 +70,10 @@ export declare class Ped extends BaseEntity {
52
70
  /**
53
71
  * @returns the last mount that this ped was on, or null if it doesn't exist
54
72
  */
73
+ get LastMount(): Ped | null;
74
+ /**
75
+ * @returns the the current mount that the ped is on, or null if there isn't one
76
+ */
55
77
  get Mount(): Ped | null;
56
78
  /**
57
79
  * returns the horse that this ped is leading
@@ -159,4 +181,27 @@ export declare class Ped extends BaseEntity {
159
181
  */
160
182
  applyDamagePack(damagePack: string, damage: number, mult: number): void;
161
183
  get CurrentVehicle(): Vehicle | null;
184
+ giveHashCommand(commandHash: number, activationDuration: number): void;
185
+ /**
186
+ * Adds or removes the ped stamina, depending on of the amount is positive or negative.
187
+ * @param amount the amount of stamina to add/remove
188
+ */
189
+ changeStamina(amount: number): void;
190
+ get MaxStamina(): number;
191
+ /**
192
+ * Returns the amount of stamina the ped has
193
+ */
194
+ get Stamina(): number;
195
+ /**
196
+ * returns the normalized stamina for the player, taking into account their unlocked stamina
197
+ */
198
+ get StaminaNormalized(): number;
199
+ resetStamina(): void;
200
+ setOwnsAnimal(ped: Ped, p2?: number): void;
201
+ addAmmo(weapon: WeaponModel, amount: number, addReason?: ItemAddReason): void;
202
+ clearLastDamage(): void;
203
+ disableAmmoType(ammo: AmmoModel): void;
204
+ disableAmmoForWeapon(weapon: WeaponModel, ammo: AmmoModel): void;
205
+ get HasPistol(): boolean;
206
+ get HasRepeater(): boolean;
162
207
  }
package/entities/Ped.js CHANGED
@@ -1,6 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { Tasks } from "../Task";
4
+ import { ItemAddReason } from "../inventory/InventoryTypes";
4
5
  import { _N } from "../utils/Native";
5
6
  import { Attributes } from "../Attribute";
6
7
  import { BaseEntity } from "./BaseEntity";
@@ -11,9 +12,50 @@ class Ped extends BaseEntity {
11
12
  }
12
13
  attributes;
13
14
  tasks;
15
+ /**
16
+ * Gets the entity from the handle given, if the entity doesn't exist it will return
17
+ * null.
18
+ */
19
+ static fromHandle(handle) {
20
+ if (handle === 0 || !DoesEntityExist(handle)) {
21
+ return null;
22
+ }
23
+ return new Ped(handle);
24
+ }
25
+ /**
26
+ * Gets the ped from the current network id, this doesn't check that
27
+ * the entity is actually a ped
28
+ */
29
+ static fromNetworkId(netId) {
30
+ if (netId === 0 || !NetworkDoesEntityExistWithNetworkId(netId)) {
31
+ return null;
32
+ }
33
+ return new Ped(NetToPed(netId));
34
+ }
35
+ static fromStateBagName(bagName) {
36
+ const ent = GetEntityFromStateBagName(bagName);
37
+ if (ent === 0) {
38
+ return null;
39
+ }
40
+ return new Ped(ent);
41
+ }
14
42
  constructor(handle) {
15
43
  super(handle);
16
44
  }
45
+ /**
46
+ * @returns the current horse or vehicle the ped is on, or null if they're not on either
47
+ */
48
+ get MountedEntity() {
49
+ const veh = this.CurrentVehicle;
50
+ if (veh !== null) {
51
+ return veh;
52
+ }
53
+ const horse = this.Mount;
54
+ if (horse !== null) {
55
+ return horse;
56
+ }
57
+ return null;
58
+ }
17
59
  /**
18
60
  * Blocks scenarios inbetween the specified vectors
19
61
  * @todo Move to Game
@@ -52,13 +94,13 @@ class Ped extends BaseEntity {
52
94
  * While this increases the peds max health, if used on a player it wont increase the max core value on the hud
53
95
  */
54
96
  set MaxHealth(amount) {
55
- SetPedMaxHealth(this.Handle, amount);
97
+ SetPedMaxHealth(this.handle, amount);
56
98
  }
57
99
  /**
58
100
  * @returns the maximum health of the ped
59
101
  */
60
102
  get MaxHealth() {
61
- return GetPedMaxHealth(this.Handle);
103
+ return GetPedMaxHealth(this.handle);
62
104
  }
63
105
  /**
64
106
  * @returns the {@link Attributes} for the current ped
@@ -68,158 +110,160 @@ class Ped extends BaseEntity {
68
110
  return this.attributes = new Attributes(this);
69
111
  }
70
112
  get InVehicle() {
71
- return IsPedInAnyVehicle(this.Handle, true);
113
+ return IsPedInAnyVehicle(this.handle, true);
72
114
  }
73
115
  get IsInjured() {
74
- return IsPedInjured(this.Handle);
116
+ return IsPedInjured(this.handle);
75
117
  }
76
118
  get IsFatallyInjured() {
77
- return IsPedFatallyInjured(this.Handle);
119
+ return IsPedFatallyInjured(this.handle);
78
120
  }
79
121
  get IsPlayer() {
80
- return IsPedAPlayer(this.Handle);
122
+ return IsPedAPlayer(this.handle);
81
123
  }
82
124
  get IsShooting() {
83
- return IsPedShooting(this.Handle);
125
+ return IsPedShooting(this.handle);
84
126
  }
85
127
  get Accuracy() {
86
- return GetPedAccuracy(this.Handle);
128
+ return GetPedAccuracy(this.handle);
87
129
  }
88
130
  set Accuracy(accuracy) {
89
- SetPedAccuracy(this.Handle, accuracy);
131
+ SetPedAccuracy(this.handle, accuracy);
90
132
  }
91
133
  get CanBeKnockedOffVehicle() {
92
- return CanKnockPedOffVehicle(this.Handle);
134
+ return CanKnockPedOffVehicle(this.handle);
93
135
  }
94
136
  get IsMale() {
95
- return IsPedMale(this.Handle);
137
+ return IsPedMale(this.handle);
96
138
  }
97
139
  get IsHuman() {
98
- return IsPedHuman(this.Handle);
140
+ return IsPedHuman(this.handle);
99
141
  }
100
142
  get IsOnTopOfVehicle() {
101
- return IsPedOnVehicle(this.Handle, false);
143
+ return IsPedOnVehicle(this.handle, false);
102
144
  }
103
145
  get Vehicle() {
104
- const vehicle = GetVehiclePedIsIn(this.Handle, false);
105
- if (vehicle === 0) {
106
- return null;
107
- }
108
- return new Vehicle(vehicle);
146
+ return Vehicle.fromHandle(GetVehiclePedIsIn(this.handle, false));
109
147
  }
110
148
  /**
111
149
  * @returns the last mount that this ped was on, or null if it doesn't exist
112
150
  */
151
+ get LastMount() {
152
+ const pedId = _N("0x4C8B59171957BCF7", this.handle, Citizen.resultAsInteger());
153
+ return Ped.fromHandle(pedId);
154
+ }
155
+ /**
156
+ * @returns the the current mount that the ped is on, or null if there isn't one
157
+ */
113
158
  get Mount() {
114
- const pedId = _N("0x4C8B59171957BCF7", this.Handle, Citizen.resultAsInteger());
115
- return pedId ? new Ped(pedId) : null;
159
+ return Ped.fromHandle(GetMount(this.handle));
116
160
  }
117
161
  /**
118
162
  * returns the horse that this ped is leading
119
163
  */
120
164
  get LeadingHorse() {
121
- const pedId = _N("0x693126B5D0457D0D", this.Handle, Citizen.resultAsInteger());
122
- return pedId ? new Ped(pedId) : null;
165
+ const pedId = _N("0x693126B5D0457D0D", this.handle, Citizen.resultAsInteger());
166
+ return Ped.fromHandle(pedId);
123
167
  }
124
168
  /**
125
169
  * returns the owner of the current animal
126
170
  */
127
171
  get Owner() {
128
- const pedId = _N("0xF103823FFE72BB49", this.Handle, Citizen.resultAsInteger());
129
- return pedId ? new Ped(pedId) : null;
172
+ const pedId = _N("0xF103823FFE72BB49", this.handle, Citizen.resultAsInteger());
173
+ return Ped.fromHandle(pedId);
130
174
  }
131
175
  get TamingState() {
132
- return _N("0x454AD4DA6C41B5BD", this.Handle, Citizen.resultAsInteger());
176
+ return _N("0x454AD4DA6C41B5BD", this.handle, Citizen.resultAsInteger());
133
177
  }
134
178
  get IsInteractingWithAnimal() {
135
- return _N("0x7FC84E85D98F063D", this.Handle, Citizen.resultAsInteger());
179
+ return _N("0x7FC84E85D98F063D", this.handle, Citizen.resultAsInteger());
136
180
  }
137
181
  get IsSittingInAnyVehicle() {
138
- return IsPedSittingInAnyVehicle(this.Handle);
182
+ return IsPedSittingInAnyVehicle(this.handle);
139
183
  }
140
184
  get IsPlantingBomb() {
141
- return IsPedPlantingBomb(this.Handle);
185
+ return IsPedPlantingBomb(this.handle);
142
186
  }
143
187
  get IsInAnyBoat() {
144
- return IsPedInAnyBoat(this.Handle);
188
+ return IsPedInAnyBoat(this.handle);
145
189
  }
146
190
  get IsInAnyHeli() {
147
- return IsPedInAnyHeli(this.Handle);
191
+ return IsPedInAnyHeli(this.handle);
148
192
  }
149
193
  get IsInAnyPlane() {
150
- return IsPedInAnyPlane(this.Handle);
194
+ return IsPedInAnyPlane(this.handle);
151
195
  }
152
196
  get IsInFlyingVehicle() {
153
- return IsPedInFlyingVehicle(this.Handle);
197
+ return IsPedInFlyingVehicle(this.handle);
154
198
  }
155
199
  get IsFalling() {
156
- return IsPedFalling(this.Handle);
200
+ return IsPedFalling(this.handle);
157
201
  }
158
202
  get IsSliding() {
159
- return _N("0xD6740E14E4CEFC0B", this.Handle, Citizen.resultAsInteger());
203
+ return _N("0xD6740E14E4CEFC0B", this.handle, Citizen.resultAsInteger());
160
204
  }
161
205
  get IsJumping() {
162
- return IsPedJumping(this.Handle);
206
+ return IsPedJumping(this.handle);
163
207
  }
164
208
  get IsClimbing() {
165
- return IsPedClimbing(this.Handle);
209
+ return IsPedClimbing(this.handle);
166
210
  }
167
211
  get IsClimbingLadder() {
168
- return _N("0x59643424B68D52B5", this.Handle, Citizen.resultAsInteger());
212
+ return _N("0x59643424B68D52B5", this.handle, Citizen.resultAsInteger());
169
213
  }
170
214
  get IsVaulting() {
171
- return IsPedVaulting(this.Handle);
215
+ return IsPedVaulting(this.handle);
172
216
  }
173
217
  get IsDiving() {
174
- return IsPedDiving(this.Handle);
218
+ return IsPedDiving(this.handle);
175
219
  }
176
220
  get IsOpeningADoor() {
177
- return IsPedOpeningADoor(this.Handle);
221
+ return IsPedOpeningADoor(this.handle);
178
222
  }
179
223
  set SeeingRange(value) {
180
- SetPedSeeingRange(this.Handle, value);
224
+ SetPedSeeingRange(this.handle, value);
181
225
  }
182
226
  set HearingRange(value) {
183
- SetPedHearingRange(this.Handle, value);
227
+ SetPedHearingRange(this.handle, value);
184
228
  }
185
229
  get IsStealthed() {
186
- return GetPedStealthMovement(this.Handle);
230
+ return GetPedStealthMovement(this.handle);
187
231
  }
188
232
  get IsJacking() {
189
- return IsPedJacking(this.Handle);
233
+ return IsPedJacking(this.handle);
190
234
  }
191
235
  get IsStunned() {
192
- return IsPedBeingStunned(this.Handle, 0);
236
+ return IsPedBeingStunned(this.handle, 0);
193
237
  }
194
238
  get IsBeingJacked() {
195
- return IsPedBeingJacked(this.Handle);
239
+ return IsPedBeingJacked(this.handle);
196
240
  }
197
241
  get IsInCombatRoll() {
198
- return _N("0xC48A9EB0D499B3E5", this.Handle, Citizen.resultAsInteger());
242
+ return _N("0xC48A9EB0D499B3E5", this.handle, Citizen.resultAsInteger());
199
243
  }
200
244
  get CrouchMovement() {
201
- return _N("0xD5FE956C70FF370B", this.Handle, Citizen.resultAsInteger());
245
+ return _N("0xD5FE956C70FF370B", this.handle, Citizen.resultAsInteger());
202
246
  }
203
247
  /**
204
248
  * returns true if {@link DamageCleanliness} was ever lower than {@link eDamageCleanliness.Good}
205
249
  */
206
250
  get IsDamaged() {
207
- return _N("0x6CFC373008A1EDAF", this.Handle, Citizen.resultAsInteger());
251
+ return _N("0x6CFC373008A1EDAF", this.handle, Citizen.resultAsInteger());
208
252
  }
209
253
  set IsDamaged(damaged) {
210
- _N("0xDACE03C65C6666DB", this.Handle, damaged);
254
+ _N("0xDACE03C65C6666DB", this.handle, damaged);
211
255
  }
212
256
  get DamageCleanliness() {
213
- return _N("0x88EFFED5FE8B0B4A", this.Handle, Citizen.resultAsInteger());
257
+ return _N("0x88EFFED5FE8B0B4A", this.handle, Citizen.resultAsInteger());
214
258
  }
215
259
  set DamageCleanliness(cleanliness) {
216
- _N("0x7528720101A807A5", this.Handle, cleanliness);
260
+ _N("0x7528720101A807A5", this.handle, cleanliness);
217
261
  }
218
262
  set DefenseModifier(amount) {
219
- _N("0x9B6808EC46BE849B", this.Handle, amount);
263
+ _N("0x9B6808EC46BE849B", this.handle, amount);
220
264
  }
221
265
  set CanBeTargeted(toggle) {
222
- SetPedCanBeTargetted(this.Handle, toggle);
266
+ SetPedCanBeTargetted(this.handle, toggle);
223
267
  }
224
268
  // TODO: Team class wrapper
225
269
  // TODO: Bone wrapper `GET_PED_LAST_DAMAGE_BONE`
@@ -227,31 +271,31 @@ class Ped extends BaseEntity {
227
271
  * returns the ped who jacked this ped
228
272
  */
229
273
  getJacker() {
230
- return new Ped(GetPedsJacker(this.Handle));
274
+ return new Ped(GetPedsJacker(this.handle));
231
275
  }
232
276
  setCrouchMovement(state, immediately = false) {
233
- _N("0x7DE9692C6F64CFE8", this.Handle, state, 0, immediately);
277
+ _N("0x7DE9692C6F64CFE8", this.handle, state, 0, immediately);
234
278
  }
235
279
  canBeTargetedByPlayer(player, toggle) {
236
- SetPedCanBeTargettedByPlayer(this.Handle, player.Handle, toggle);
280
+ SetPedCanBeTargettedByPlayer(this.handle, player.Handle, toggle);
237
281
  }
238
282
  clearLastBoneDamage() {
239
- ClearPedLastDamageBone(this.Handle);
283
+ ClearPedLastDamageBone(this.handle);
240
284
  }
241
285
  set OwnsAnimal(animal) {
242
- _N("0x931B241409216C1F", this.Handle, animal.Handle, false);
286
+ _N("0x931B241409216C1F", this.handle, animal.Handle, false);
243
287
  }
244
288
  isInteractionPossible(animal) {
245
- return _N("0xD543D3A8FDE4F185", this.Handle, animal.Handle, Citizen.resultAsInteger());
289
+ return _N("0xD543D3A8FDE4F185", this.handle, animal.Handle, Citizen.resultAsInteger());
246
290
  }
247
291
  isOnVehicle(vehicle) {
248
- return IsPedOnSpecificVehicle(this.Handle, vehicle.Handle);
292
+ return IsPedOnSpecificVehicle(this.handle, vehicle.Handle);
249
293
  }
250
294
  isSittingInVehicle(vehicle) {
251
- return IsPedSittingInVehicle(this.Handle, vehicle.Handle);
295
+ return IsPedSittingInVehicle(this.handle, vehicle.Handle);
252
296
  }
253
297
  warpOutOfVehicle() {
254
- _N("0xE0B61ED8BB37712F", this.Handle);
298
+ _N("0xE0B61ED8BB37712F", this.handle);
255
299
  }
256
300
  /**
257
301
  * puts the ped onto the specified mount
@@ -259,10 +303,10 @@ class Ped extends BaseEntity {
259
303
  * @param seatIndex the seat index to put the ped on
260
304
  */
261
305
  setOntoMount(targetPed, seatIndex) {
262
- _N("0x028F76B6E78246EB", this.Handle, targetPed.Handle, seatIndex, true);
306
+ _N("0x028F76B6E78246EB", this.handle, targetPed.Handle, seatIndex, true);
263
307
  }
264
308
  removeFromMount() {
265
- _N("0x5337B721C51883A9", this.Handle, true, true);
309
+ _N("0x5337B721C51883A9", this.handle, true, true);
266
310
  }
267
311
  /**
268
312
  * Sets the ped into the specified vehicle
@@ -270,31 +314,31 @@ class Ped extends BaseEntity {
270
314
  * @param seatIndex the seat index to put the ped into
271
315
  */
272
316
  setIntoVehicle(vehicle, seatIndex) {
273
- SetPedIntoVehicle(this.Handle, vehicle.Handle, seatIndex);
317
+ SetPedIntoVehicle(this.handle, vehicle.Handle, seatIndex);
274
318
  }
275
319
  /**
276
320
  * kills the ped and optionally sets the killer
277
321
  * @param killer the entity that killed the ped
278
322
  */
279
323
  killPed(killer) {
280
- SetEntityHealth(this.Handle, 0, killer ? killer.Handle : 0);
324
+ SetEntityHealth(this.handle, 0, killer ? killer.Handle : 0);
281
325
  }
282
326
  damage(amount, boneId = 0, killer) {
283
- ApplyDamageToPed(this.Handle, amount, 0, boneId, killer ? killer.Handle : 0);
327
+ ApplyDamageToPed(this.handle, amount, 0, boneId, killer ? killer.Handle : 0);
284
328
  }
285
329
  /**
286
330
  * this returns a different type then the getter so we can't use set, maybe ts will fix soon (tm)
287
331
  * @param state how hard it will be to knock a ped off their vehicle
288
332
  */
289
333
  setCanBeKnockedOffVehicle(state) {
290
- SetPedCanBeKnockedOffVehicle(this.Handle, state);
334
+ SetPedCanBeKnockedOffVehicle(this.handle, state);
291
335
  }
292
336
  /**
293
337
  * Removes the specified ped if its not a player entity
294
338
  */
295
339
  delete() {
296
- SetEntityAsMissionEntity(this.Handle, true, true);
297
- DeletePed(this.Handle);
340
+ SetEntityAsMissionEntity(this.handle, true, true);
341
+ DeletePed(this.handle);
298
342
  }
299
343
  /**
300
344
  * creates a clone of the ped
@@ -304,23 +348,23 @@ class Ped extends BaseEntity {
304
348
  * @returns the cloned ped
305
349
  */
306
350
  clone(network, bScriptHostPed, copyHeadBlend) {
307
- return new Ped(ClonePed(this.Handle, network, bScriptHostPed, copyHeadBlend));
351
+ return new Ped(ClonePed(this.handle, network, bScriptHostPed, copyHeadBlend));
308
352
  }
309
353
  /**
310
354
  * clones the ped onto the target ped
311
355
  * @param targetPed the ped to clone onto
312
356
  */
313
357
  cloneTo(targetPed) {
314
- ClonePedToTarget(this.Handle, targetPed.Handle);
358
+ ClonePedToTarget(this.handle, targetPed.Handle);
315
359
  }
316
360
  /**
317
361
  * @param amount - the amount of armour to add to the ped
318
362
  */
319
363
  addArmour(amount) {
320
- AddArmourToPed(this.Handle, amount);
364
+ AddArmourToPed(this.handle, amount);
321
365
  }
322
366
  applyDamage(damageAmount, boneId = 0, pedKiller = null) {
323
- ApplyDamageToPed(this.Handle, damageAmount, 0, boneId, pedKiller ? pedKiller.Handle : 0);
367
+ ApplyDamageToPed(this.handle, damageAmount, 0, boneId, pedKiller ? pedKiller.Handle : 0);
324
368
  }
325
369
  /**
326
370
  * @param damagePack - the damage decal to apply see [here](https://github.com/femga/rdr3_discoveries/blob/master/peds_customization/ped_decals.lua) for more documentation
@@ -328,10 +372,10 @@ class Ped extends BaseEntity {
328
372
  * @param mult - the multiplier?
329
373
  */
330
374
  applyDamagePack(damagePack, damage, mult) {
331
- ApplyPedDamagePack(this.Handle, damagePack, damage, mult);
375
+ ApplyPedDamagePack(this.handle, damagePack, damage, mult);
332
376
  }
333
377
  get CurrentVehicle() {
334
- const veh = GetVehiclePedIsIn(this.Handle, false);
378
+ const veh = GetVehiclePedIsIn(this.handle, false);
335
379
  if (veh === 0) return null;
336
380
  return new Vehicle(veh);
337
381
  }
@@ -339,6 +383,56 @@ class Ped extends BaseEntity {
339
383
  // applyBloodSpecific() {
340
384
  // ApplyPedBloodSpecific
341
385
  // }
386
+ giveHashCommand(commandHash, activationDuration) {
387
+ Citizen.invokeNative("0xD65FDC686A031C83", this.handle, commandHash, activationDuration);
388
+ }
389
+ /**
390
+ * Adds or removes the ped stamina, depending on of the amount is positive or negative.
391
+ * @param amount the amount of stamina to add/remove
392
+ */
393
+ changeStamina(amount) {
394
+ _N("0xC3D4B754C0E86B9E", this.handle, amount);
395
+ }
396
+ get MaxStamina() {
397
+ return _N("0xCB42AFE2B613EE55", this.handle);
398
+ }
399
+ /**
400
+ * Returns the amount of stamina the ped has
401
+ */
402
+ get Stamina() {
403
+ return _N("0x775A1CA7893AA8B5", this.handle);
404
+ }
405
+ /**
406
+ * returns the normalized stamina for the player, taking into account their unlocked stamina
407
+ */
408
+ get StaminaNormalized() {
409
+ return _N("0x22F2A386D43048A9", this.handle);
410
+ }
411
+ resetStamina() {
412
+ _N("0x36513AFFC703C60D", this.handle);
413
+ }
414
+ setOwnsAnimal(ped, p2 = 0) {
415
+ _N("0x931B241409216C1F", this.handle, ped.Handle, p2);
416
+ }
417
+ // WEAPON NAMESPACE
418
+ addAmmo(weapon, amount, addReason = ItemAddReason.Default) {
419
+ Citizen.invokeNative("0xB190BCA3F4042F95", this.handle, weapon.Hash, amount, addReason);
420
+ }
421
+ clearLastDamage() {
422
+ Citizen.invokeNative("0x087D8F4BC65F68E4", this.handle);
423
+ }
424
+ disableAmmoType(ammo) {
425
+ Citizen.invokeNative("0xAA5A52204E077883", this.handle, ammo.Hash);
426
+ }
427
+ disableAmmoForWeapon(weapon, ammo) {
428
+ Citizen.invokeNative("0xF0D728EEA3C99775", this.handle, weapon.Hash, ammo.Hash);
429
+ }
430
+ get HasPistol() {
431
+ return Citizen.invokeNative("0xBFCA7AFABF9D7967", this.handle);
432
+ }
433
+ get HasRepeater() {
434
+ return Citizen.invokeNative("0x495A04CAEC263AF8", this.handle);
435
+ }
342
436
  }
343
437
  export {
344
438
  Ped
@@ -1,3 +1,4 @@
1
+ import type { Ped } from "./Ped";
1
2
  export declare class Player {
2
3
  private handle;
3
4
  static fromPedHandle(handle: number): Player;
@@ -18,4 +19,5 @@ export declare class Player {
18
19
  addStaminaUpgrade(amount: number): void;
19
20
  addHealthUpgrade(amount: number): void;
20
21
  addDeadeyeUpgrade(amount: number): void;
22
+ setOwnsMount(mount: Ped): void;
21
23
  }
@@ -51,6 +51,9 @@ class Player {
51
51
  addDeadeyeUpgrade(amount) {
52
52
  handleUpgrade("UPGRADE_DEADEYE_TANK_1", amount);
53
53
  }
54
+ setOwnsMount(mount) {
55
+ _N("0xE6D4E435B56D5BD0", this.handle, mount.Handle);
56
+ }
54
57
  }
55
58
  export {
56
59
  Player
@@ -2,6 +2,17 @@ import type { VehicleSeat } from "../enums/VehicleSeat";
2
2
  import { BaseEntity } from "./BaseEntity";
3
3
  export declare class Vehicle extends BaseEntity {
4
4
  constructor(handle: number);
5
+ /**
6
+ * Gets the entity from the handle given, if the entity doesn't exist it will return
7
+ * null.
8
+ */
9
+ static fromHandle(handle: number): Vehicle | null;
10
+ /**
11
+ * Gets the ped from the current network id, this doesn't check that
12
+ * the entity is actually a ped
13
+ */
14
+ static fromNetworkId(netId: number): Vehicle | null;
15
+ static fromStateBagName(bagName: string): Vehicle | null;
5
16
  /**
6
17
  *
7
18
  * @param seatIndex the seat index to check
@@ -9,6 +9,33 @@ class Vehicle extends BaseEntity {
9
9
  constructor(handle) {
10
10
  super(handle);
11
11
  }
12
+ /**
13
+ * Gets the entity from the handle given, if the entity doesn't exist it will return
14
+ * null.
15
+ */
16
+ static fromHandle(handle) {
17
+ if (handle === 0 || !DoesEntityExist(handle)) {
18
+ return null;
19
+ }
20
+ return new Vehicle(handle);
21
+ }
22
+ /**
23
+ * Gets the ped from the current network id, this doesn't check that
24
+ * the entity is actually a ped
25
+ */
26
+ static fromNetworkId(netId) {
27
+ if (netId === 0 || !NetworkDoesEntityExistWithNetworkId(netId)) {
28
+ return null;
29
+ }
30
+ return new Vehicle(NetToPed(netId));
31
+ }
32
+ static fromStateBagName(bagName) {
33
+ const ent = GetEntityFromStateBagName(bagName);
34
+ if (ent === 0) {
35
+ return null;
36
+ }
37
+ return new Vehicle(ent);
38
+ }
12
39
  /**
13
40
  *
14
41
  * @param seatIndex the seat index to check
package/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
+ export * from "./Ammo";
1
2
  export * from "./Attribute";
3
+ export * from "./BufferedClass";
2
4
  export * from "./Controls";
3
5
  export * from "./Game";
4
6
  export * from "./GameConstants";
@@ -8,6 +10,7 @@ export * from "./RawKeymaps";
8
10
  export * from "./RelationshipGroup";
9
11
  export * from "./Task";
10
12
  export * from "./Volume";
13
+ export * from "./Weapons";
11
14
  export * from "./world/createDraftVehicle";
12
15
  export * from "./world/createPed";
13
16
  export * from "./world/createProp";
@@ -15,6 +18,11 @@ export * from "./world/createVehicle";
15
18
  export * from "./utils/Animations";
16
19
  export * from "./utils/Native";
17
20
  export * from "./types/Throwable";
21
+ export * from "./models/AmmoModel";
22
+ export * from "./models/WeaponModel";
23
+ export * from "./inventory/Inventory";
24
+ export * from "./inventory/InventoryGUID";
25
+ export * from "./inventory/InventoryTypes";
18
26
  export * from "./interfaces/Dimensions";
19
27
  export * from "./enums/AnimationFlags";
20
28
  export * from "./enums/Attributes";
@@ -29,6 +37,7 @@ export * from "./enums/Relationship";
29
37
  export * from "./enums/VehicleSeat";
30
38
  export * from "./entities/BaseEntity";
31
39
  export * from "./entities/Entity";
40
+ export * from "./entities/HorsePeltEntries";
32
41
  export * from "./entities/Ped";
33
42
  export * from "./entities/Pickup";
34
43
  export * from "./entities/Player";