@nativewrappers/fivem 0.0.115 → 0.0.117

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,5 +1,7 @@
1
1
  export declare class GlobalData {
2
2
  static CurrentResource: string;
3
+ static GameName: string;
4
+ static GameBuild: number;
3
5
  static IS_SERVER: boolean;
4
6
  static IS_CLIENT: boolean;
5
7
  static NetworkTick: number | null;
@@ -5,6 +5,8 @@ class GlobalData {
5
5
  __name(this, "GlobalData");
6
6
  }
7
7
  static CurrentResource = GetCurrentResourceName();
8
+ static GameName = GetGameName();
9
+ static GameBuild = GetGameBuildNumber();
8
10
  static IS_SERVER = IsDuplicityVersion();
9
11
  static IS_CLIENT = !GlobalData.IS_SERVER;
10
12
  static NetworkTick = null;
@@ -19,6 +19,17 @@ export declare function Exports(exportName: string): (originalMethod: any, conte
19
19
  * @param eventName the event to bind to
20
20
  */
21
21
  export declare function Event(eventName: string): (originalMethod: any, context: ClassMethodDecoratorContext) => void;
22
+ /**
23
+ * Registers the Event call for {@link eventName} to this method.
24
+ *
25
+ * This has internal pretty-printing to make errors easier to track, if
26
+ * you want to disable this you will need to call {@link DisablePrettyPrint}, or if you're
27
+ * using esbuild you can add `REMOVE_EVENT_LOG` to your drop label {@link https://esbuild.github.io/api/#drop-labels}
28
+ *
29
+ * This is the same thing as just using `Event` but this disambiguates the call from DOM
30
+ * @param eventName the event to bind to
31
+ */
32
+ export declare const CfxEvent: typeof Event;
22
33
  /**
23
34
  * Registers the Net Event call for {@link eventName} to this method
24
35
  *
@@ -80,6 +80,7 @@ function Event(eventName) {
80
80
  }, "actualDecorator");
81
81
  }
82
82
  __name(Event, "Event");
83
+ const CfxEvent = Event;
83
84
  function NetEvent(eventName, remoteOnly = true) {
84
85
  return /* @__PURE__ */ __name(function actualDecorator(originalMethod, context) {
85
86
  if (context.private) {
@@ -195,6 +196,7 @@ function SetTick() {
195
196
  }
196
197
  __name(SetTick, "SetTick");
197
198
  export {
199
+ CfxEvent,
198
200
  ConVar,
199
201
  ConVarType,
200
202
  DisablePrettyPrint,
@@ -11,8 +11,6 @@ class BaseEntityBoneCollection {
11
11
  hasBone(name) {
12
12
  return GetEntityBoneIndexByName(this.owner.Handle, name) !== -1;
13
13
  }
14
- // return new EntityBone(this.owner, -1);
15
- // }
16
14
  }
17
15
  export {
18
16
  BaseEntityBoneCollection
package/models/Ped.js CHANGED
@@ -24,7 +24,7 @@ class Ped extends BaseEntity {
24
24
  if (handle === 0 || !DoesEntityExist(handle)) {
25
25
  return null;
26
26
  }
27
- return new Ped(handle);
27
+ return new this(handle);
28
28
  }
29
29
  static fromNetworkId(networkId) {
30
30
  if (!NetworkDoesEntityExistWithNetworkId(networkId)) {
@@ -58,9 +58,9 @@ export declare class Player {
58
58
  get Name(): string;
59
59
  get PvPEnabled(): boolean;
60
60
  set PvPEnabled(value: boolean);
61
+ set Ghosted(isGhosted: boolean);
61
62
  get IsDead(): boolean;
62
63
  set DisableFiring(value: boolean);
63
- set Ghosted(isGhosted: boolean);
64
64
  get EntityPlayerIsAimingAt(): Entity | null;
65
65
  get StealthNoise(): number;
66
66
  get FakeWantedLevel(): number;
package/models/Player.js CHANGED
@@ -81,9 +81,6 @@ class Player {
81
81
  constructor(handle = -1) {
82
82
  this.handle = handle;
83
83
  this.source = this.ServerId;
84
- if (!IsDuplicityVersion()) {
85
- this.PvPEnabled = true;
86
- }
87
84
  }
88
85
  get Handle() {
89
86
  return this.handle;
@@ -147,12 +144,6 @@ class Player {
147
144
  SetCanAttackFriendly(this.Character.Handle, value, value);
148
145
  this.pvp = value;
149
146
  }
150
- get IsDead() {
151
- return IsPlayerDead(this.handle);
152
- }
153
- set DisableFiring(value) {
154
- DisablePlayerFiring(this.handle, value);
155
- }
156
147
  set Ghosted(isGhosted) {
157
148
  if (this.Handle === 128) {
158
149
  SetLocalPlayerAsGhost(isGhosted);
@@ -160,6 +151,12 @@ class Player {
160
151
  SetRelationshipToPlayer(this.handle, isGhosted);
161
152
  }
162
153
  }
154
+ get IsDead() {
155
+ return IsPlayerDead(this.handle);
156
+ }
157
+ set DisableFiring(value) {
158
+ DisablePlayerFiring(this.handle, value);
159
+ }
163
160
  get EntityPlayerIsAimingAt() {
164
161
  const [entityHit, entity] = GetEntityPlayerIsFreeAimingAt(this.handle);
165
162
  if (entityHit) {
@@ -183,9 +180,6 @@ class Player {
183
180
  return GetPlayerHealthRechargeLimit(this.handle);
184
181
  }
185
182
  get IsInvincible() {
186
- if (IsDuplicityVersion()) {
187
- return GetPlayerInvincible(this.handle);
188
- }
189
183
  return GetPlayerInvincible_2(this.handle);
190
184
  }
191
185
  get MaxArmor() {
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "license": "MIT",
10
10
  "type": "module",
11
- "version": "0.0.115",
11
+ "version": "0.0.117",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/nativewrappers/nativewrappers.git"
@@ -6,7 +6,7 @@ const DlcWeaponData = /* @__PURE__ */ new Map();
6
6
  function initializeOnce() {
7
7
  let isInitialized = false;
8
8
  return () => {
9
- if (isInitialized || IsDuplicityVersion()) {
9
+ if (isInitialized || GetGameName() !== "fivem") {
10
10
  return;
11
11
  }
12
12
  const intLength = 4;
@@ -7,7 +7,7 @@ const WeaponHudStats = /* @__PURE__ */ new Map();
7
7
  function initializeOnce() {
8
8
  let isInitialized = false;
9
9
  return () => {
10
- if (isInitialized || IsDuplicityVersion()) {
10
+ if (isInitialized || GetGameName() !== "fivem") {
11
11
  return;
12
12
  }
13
13
  const intLength = 4;
@@ -6,7 +6,7 @@ const DlcWeaponComponentData = /* @__PURE__ */ new Map();
6
6
  function initializeOnce() {
7
7
  let isInitialized = false;
8
8
  return () => {
9
- if (isInitialized || IsDuplicityVersion()) {
9
+ if (isInitialized || GetGameName() !== "fivem") {
10
10
  return;
11
11
  }
12
12
  const intLength = 4;
@@ -834,7 +834,7 @@ const WeaponComponentHashesByWeaponHash = /* @__PURE__ */ new Map([
834
834
  function initializeOnce() {
835
835
  let isInitialized = false;
836
836
  return () => {
837
- if (isInitialized || IsDuplicityVersion()) {
837
+ if (isInitialized || GetGameName() !== "fivem") {
838
838
  return;
839
839
  }
840
840
  const intLength = 4;
@@ -7,7 +7,7 @@ const WeaponComponentHudStats = /* @__PURE__ */ new Map();
7
7
  function initializeOnce() {
8
8
  let isInitialized = false;
9
9
  return () => {
10
- if (isInitialized || IsDuplicityVersion()) {
10
+ if (isInitialized || GetGameName() !== "fivem") {
11
11
  return;
12
12
  }
13
13
  const intLength = 4;