@nativewrappers/fivem 0.0.134 → 0.0.136

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/World.js CHANGED
@@ -430,7 +430,10 @@ class World {
430
430
  * const rope = await World.createRope(position, rotation, 15.0, RopeType.ThickRope, 3.0, 0.5);
431
431
  * ```
432
432
  *
433
- * You should manually call `RopeUnloadTextures()` after you finish using **all** ropes, unlike models requesting rope models is instantaneous
433
+ * You should manually call `RopeUnloadTextures()` after you finish using **all** ropes, unlike models
434
+ * requesting to unload rope models will instantly unload *all* rope textures, so if you have other scripts
435
+ * using ropes, those ropes will go inivisible.
436
+ *
434
437
  * If called with collisionOn you will have to LoadRopeData after
435
438
  */
436
439
  static async createRope(position, rotation, maxLength, ropeType, initLength, minLength, lengthChangeRate = 1, onlyPPU = false, collisionOn = false, lockFromFront = false, timeMultiplier = 1, breakable = false, shouldLoadTextures = true) {
@@ -2,34 +2,6 @@
2
2
  * Disables pretty printing in error messages
3
3
  */
4
4
  export declare const DisablePrettyPrint: () => boolean;
5
- export declare enum Binding {
6
- /**
7
- * No one can call this
8
- */
9
- None = 0,
10
- /**
11
- * Server only accepts server calls, client only client calls
12
- */
13
- Local = 1,
14
- /**
15
- * Server only accepts client calls, client only server calls
16
- */
17
- Remote = 2,
18
- /**
19
- * Accept all incoming calls
20
- * Server only accepts client calls, client only server calls
21
- */
22
- All = 3
23
- }
24
- /**
25
- * Registers the Event call for {@link eventName} to this method.
26
- *
27
- * This has internal pretty-printing to make errors easier to track, if
28
- * you want to disable this you will need to call {@link DisablePrettyPrint}, or if you're
29
- * using esbuild you can add `REMOVE_EVENT_LOG` to your drop label {@link https://esbuild.github.io/api/#drop-labels}
30
- * @param eventName the event to bind to
31
- */
32
- export declare function CfxEvent(eventName: string, binding?: Binding): (originalMethod: any, context: ClassMethodDecoratorContext) => void;
33
5
  /**
34
6
  * Registers the Event call for {@link eventName} to this method.
35
7
  *
@@ -39,7 +11,8 @@ export declare function CfxEvent(eventName: string, binding?: Binding): (origina
39
11
  *
40
12
  * @param eventName the event to bind to
41
13
  */
42
- export declare function Event(eventName: string): (originalMethod: any, context: ClassMethodDecoratorContext) => void;
14
+ export declare function OnEvent(eventName: string): (originalMethod: any, context: ClassMethodDecoratorContext) => void;
15
+ export declare const Event: typeof OnEvent;
43
16
  /**
44
17
  * Registers the Net Event call for {@link eventName} to this method
45
18
  *
@@ -51,7 +24,8 @@ export declare function Event(eventName: string): (originalMethod: any, context:
51
24
  * @param eventName the event to bind this net event to
52
25
  * @param remoteOnly if the event should only accept remote calls, if set to true it will ignore any local call via `emit`, defaults to true
53
26
  */
54
- export declare function NetEvent(eventName: string, remoteOnly?: boolean): (originalMethod: any, context: ClassMethodDecoratorContext) => void;
27
+ export declare function OnNetEvent(eventName: string, remoteOnly?: boolean): (originalMethod: any, context: ClassMethodDecoratorContext) => void;
28
+ export declare const NetEvent: typeof OnNetEvent;
55
29
  export type NuiCallback = (data: string) => void;
56
30
  /**
57
31
  * Registers the NUI Event call for {eventName} to this method, the function signature
@@ -63,4 +37,5 @@ export type NuiCallback = (data: string) => void;
63
37
  * @param eventName the event this will listen for
64
38
  * @param dontErrorWhenCbIsntInvoked this will just block the event fro merroring when the callback is never invoked.
65
39
  */
66
- export declare function NuiEvent(eventName: string, dontErrorWhenCbIsntInvoked?: boolean): (originalMethod: any, context: ClassMethodDecoratorContext) => void;
40
+ export declare function OnNuiEvent(eventName: string, dontErrorWhenCbIsntInvoked?: boolean): (originalMethod: any, context: ClassMethodDecoratorContext) => void;
41
+ export declare const NuiEvent: typeof OnNuiEvent;
@@ -4,57 +4,7 @@ import { GlobalData } from "../GlobalData";
4
4
  const DisablePrettyPrint = /* @__PURE__ */ __name(() => GlobalData.EnablePrettyPrint = false, "DisablePrettyPrint");
5
5
  const AsyncFunction = (async () => {
6
6
  }).constructor;
7
- var Binding = /* @__PURE__ */ ((Binding2) => {
8
- Binding2[Binding2["None"] = 0] = "None";
9
- Binding2[Binding2["Local"] = 1] = "Local";
10
- Binding2[Binding2["Remote"] = 2] = "Remote";
11
- Binding2[Binding2["All"] = 3] = "All";
12
- return Binding2;
13
- })(Binding || {});
14
- function CfxEvent(eventName, binding = 1 /* Local */) {
15
- return /* @__PURE__ */ __name(function actualDecorator(originalMethod, context) {
16
- if (context.private) {
17
- throw new Error("Event does not work on private methods, please mark the method as public");
18
- }
19
- context.addInitializer(function() {
20
- const fn = (binding & 2 /* Remote */) !== 0 ? onNet : on;
21
- const _t = this;
22
- fn(eventName, async (...args) => {
23
- const src = source;
24
- if (_t.__permissionMap && binding & 2 /* Remote */) {
25
- const permissions = _t.__permissionMap.get(context.name);
26
- if (permissions) {
27
- let hasPermission = false;
28
- for (const perm of permissions) {
29
- if (IsPlayerAceAllowed(src, perm)) {
30
- hasPermission = true;
31
- break;
32
- }
33
- }
34
- if (!hasPermission) {
35
- emit("@nativewrappers:no_permission", { eventName, method: context.name });
36
- return;
37
- }
38
- }
39
- }
40
- try {
41
- return await originalMethod.call(this, ...args);
42
- } catch (e) {
43
- REMOVE_EVENT_LOG: {
44
- if (!GlobalData.EnablePrettyPrint) return;
45
- console.error("------- EVENT ERROR --------");
46
- console.error(`Call to ${eventName} errored`);
47
- console.error(`Data: ${JSON.stringify(args)}`);
48
- console.error(`Error: ${e}`);
49
- console.error("------- END EVENT ERROR --------");
50
- }
51
- }
52
- });
53
- });
54
- }, "actualDecorator");
55
- }
56
- __name(CfxEvent, "CfxEvent");
57
- function Event(eventName) {
7
+ function OnEvent(eventName) {
58
8
  return /* @__PURE__ */ __name(function actualDecorator(originalMethod, context) {
59
9
  if (context.private) {
60
10
  throw new Error("Event does not work on private methods, please mark the method as public");
@@ -77,8 +27,9 @@ function Event(eventName) {
77
27
  });
78
28
  }, "actualDecorator");
79
29
  }
80
- __name(Event, "Event");
81
- function NetEvent(eventName, remoteOnly = true) {
30
+ __name(OnEvent, "OnEvent");
31
+ const Event = OnEvent;
32
+ function OnNetEvent(eventName, remoteOnly = true) {
82
33
  return /* @__PURE__ */ __name(function actualDecorator(originalMethod, context) {
83
34
  if (context.private) {
84
35
  throw new Error("NetEvent does not work on private methods, please mark the method as public");
@@ -125,8 +76,9 @@ function NetEvent(eventName, remoteOnly = true) {
125
76
  });
126
77
  }, "actualDecorator");
127
78
  }
128
- __name(NetEvent, "NetEvent");
129
- function NuiEvent(eventName, dontErrorWhenCbIsntInvoked = false) {
79
+ __name(OnNetEvent, "OnNetEvent");
80
+ const NetEvent = OnNetEvent;
81
+ function OnNuiEvent(eventName, dontErrorWhenCbIsntInvoked = false) {
130
82
  return /* @__PURE__ */ __name(function actualDecorator(originalMethod, context) {
131
83
  if (context.private) {
132
84
  throw new Error("NuiEvent does not work on private methods, please mark the method as public");
@@ -152,12 +104,14 @@ function NuiEvent(eventName, dontErrorWhenCbIsntInvoked = false) {
152
104
  });
153
105
  }, "actualDecorator");
154
106
  }
155
- __name(NuiEvent, "NuiEvent");
107
+ __name(OnNuiEvent, "OnNuiEvent");
108
+ const NuiEvent = OnNuiEvent;
156
109
  export {
157
- Binding,
158
- CfxEvent,
159
110
  DisablePrettyPrint,
160
111
  Event,
161
112
  NetEvent,
162
- NuiEvent
113
+ NuiEvent,
114
+ OnEvent,
115
+ OnNetEvent,
116
+ OnNuiEvent
163
117
  };
package/models/Ped.js CHANGED
@@ -387,6 +387,10 @@ class Ped extends BaseEntity {
387
387
  set BlockPermanentEvents(block) {
388
388
  SetBlockingOfNonTemporaryEvents(this.handle, block);
389
389
  }
390
+ /*
391
+ * NOTE: You should generally just use {@link ped.CurrentVehicle} if you plan on using the vehicle after
392
+ * as then you don't have to do an extra native call.
393
+ */
390
394
  isInAnyVehicle() {
391
395
  return IsPedInAnyVehicle(this.handle, false);
392
396
  }
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "license": "MIT",
10
10
  "type": "module",
11
- "version": "0.0.134",
11
+ "version": "0.0.136",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/nativewrappers/nativewrappers.git"