@nativewrappers/fivem 0.0.25 → 0.0.27
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/client/Events.js +5 -2
- package/client/Game.js +4 -1
- package/client/models/BaseEntity.d.ts +1 -1
- package/client/models/BaseEntity.js +4 -5
- package/client/models/Ped.d.ts +1 -1
- package/client/models/Ped.js +1 -1
- package/client/models/Player.js +1 -1
- package/client/models/Prop.d.ts +1 -1
- package/client/models/Prop.js +1 -1
- package/client/models/Vehicle.d.ts +1 -1
- package/client/models/Vehicle.js +1 -1
- package/common/utils/Vector.d.ts +5 -4
- package/common/utils/Vector.js +8 -7
- package/package.json +1 -1
- package/server/Events.d.ts +2 -1
- package/server/Events.js +6 -4
- package/server/entities/BaseEntity.d.ts +1 -1
- package/server/entities/BaseEntity.js +1 -1
- package/server/entities/Ped.d.ts +1 -1
- package/server/entities/Ped.js +1 -1
- package/server/entities/Player.d.ts +1 -1
- package/server/entities/Player.js +1 -2
- package/server/entities/Prop.d.ts +1 -1
- package/server/entities/Prop.js +1 -1
- package/server/entities/Vehicle.d.ts +1 -1
- package/server/entities/Vehicle.js +1 -1
- package/server/enum/index.d.ts +0 -1
- package/server/enum/index.js +0 -1
- package/server/enum/ClassTypes.d.ts +0 -11
- package/server/enum/ClassTypes.js +0 -12
- /package/{client/enums → common/utils}/ClassTypes.d.ts +0 -0
- /package/{client/enums → common/utils}/ClassTypes.js +0 -0
package/client/Events.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { ClassTypes } from './enums/ClassTypes';
|
|
1
|
+
import { ClassTypes } from '../common/utils/ClassTypes';
|
|
3
2
|
import { Ped } from './models/Ped';
|
|
4
3
|
import { Vector2, Vector3, Vector4 } from './utils';
|
|
5
4
|
import { Player } from './models/Player';
|
|
@@ -9,6 +8,10 @@ import { BaseEntity } from './models';
|
|
|
9
8
|
const getClassFromArguments = (...args) => {
|
|
10
9
|
const newArgs = [];
|
|
11
10
|
for (const arg of args) {
|
|
11
|
+
if (!arg.type) {
|
|
12
|
+
newArgs.push(arg);
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
12
15
|
switch (arg.type) {
|
|
13
16
|
case ClassTypes.Vector2: {
|
|
14
17
|
newArgs.push(Vector2.fromObject(arg));
|
package/client/Game.js
CHANGED
|
@@ -430,7 +430,10 @@ export class Game {
|
|
|
430
430
|
ExtendWorldBoundaryForPlayer(vec.x, vec.y, vec.z);
|
|
431
431
|
}
|
|
432
432
|
get LastVehicle() {
|
|
433
|
-
|
|
433
|
+
const vehicle = GetPlayersLastVehicle();
|
|
434
|
+
if (vehicle === 0)
|
|
435
|
+
return null;
|
|
436
|
+
return new Vehicle(vehicle);
|
|
434
437
|
}
|
|
435
438
|
static getWaypointBlip() {
|
|
436
439
|
if (!Game.IsWaypointActive)
|
|
@@ -7,7 +7,7 @@ import { Quaternion, Vector3 } from '../utils';
|
|
|
7
7
|
import { EntityBoneCollection } from './';
|
|
8
8
|
import { EntityBone } from './EntityBone';
|
|
9
9
|
import { StateBagChangeHandler } from '../cfx';
|
|
10
|
-
import { ClassTypes } from '
|
|
10
|
+
import { ClassTypes } from '../../common/utils/ClassTypes';
|
|
11
11
|
export declare class BaseEntity {
|
|
12
12
|
static fromNetworkId(networkId: number): BaseEntity | null;
|
|
13
13
|
static fromStateBagName(stateBagName: string): BaseEntity | null;
|
|
@@ -4,17 +4,16 @@ import { Model } from '../Model';
|
|
|
4
4
|
import { Quaternion, Vector3 } from '../utils';
|
|
5
5
|
import { EntityBoneCollection } from './';
|
|
6
6
|
import cfx from '../cfx';
|
|
7
|
-
import { ClassTypes } from '
|
|
7
|
+
import { ClassTypes } from '../../common/utils/ClassTypes';
|
|
8
8
|
export class BaseEntity {
|
|
9
9
|
static fromNetworkId(networkId) {
|
|
10
10
|
return new BaseEntity(NetworkGetEntityFromNetworkId(networkId));
|
|
11
11
|
}
|
|
12
12
|
static fromStateBagName(stateBagName) {
|
|
13
13
|
const entity = GetEntityFromStateBagName(stateBagName);
|
|
14
|
-
if (entity
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
return null;
|
|
14
|
+
if (entity === 0)
|
|
15
|
+
return null;
|
|
16
|
+
return new BaseEntity(entity);
|
|
18
17
|
}
|
|
19
18
|
constructor(handle) {
|
|
20
19
|
this.stateBagCookies = [];
|
package/client/models/Ped.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { WeaponHash } from '../hashes';
|
|
|
4
4
|
import { Tasks } from '../Tasks';
|
|
5
5
|
import { PedBoneCollection, Vehicle } from './';
|
|
6
6
|
import { WeaponCollection } from '../weapon/WeaponCollection';
|
|
7
|
-
import { ClassTypes } from '
|
|
7
|
+
import { ClassTypes } from '../../common/utils/ClassTypes';
|
|
8
8
|
import { BaseEntity } from './BaseEntity';
|
|
9
9
|
export declare class Ped extends BaseEntity {
|
|
10
10
|
static exists(ped: Ped): boolean;
|
package/client/models/Ped.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Gender, RagdollType, SpeechModifier, VehicleSeat, } from '../enums';
|
|
|
3
3
|
import { Tasks } from '../Tasks';
|
|
4
4
|
import { PedBoneCollection, Vehicle } from './';
|
|
5
5
|
import { WeaponCollection } from '../weapon/WeaponCollection';
|
|
6
|
-
import { ClassTypes } from '
|
|
6
|
+
import { ClassTypes } from '../../common/utils/ClassTypes';
|
|
7
7
|
import { BaseEntity } from './BaseEntity';
|
|
8
8
|
export class Ped extends BaseEntity {
|
|
9
9
|
static exists(ped) {
|
package/client/models/Player.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Model, Color } from '..';
|
|
2
2
|
import cfx from '../cfx';
|
|
3
|
-
import { ClassTypes } from '
|
|
3
|
+
import { ClassTypes } from '../../common/utils/ClassTypes';
|
|
4
4
|
import { BaseEntity, Ped } from './';
|
|
5
5
|
export class Player {
|
|
6
6
|
static fromPedHandle(handle) {
|
package/client/models/Prop.d.ts
CHANGED
package/client/models/Prop.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Ped, VehicleDoorCollection, VehicleModCollection, VehicleWheelCollectio
|
|
|
2
2
|
import { RadioStation, VehicleClass, VehicleLandingGearState, VehicleLockStatus, VehicleRoofState, VehicleSeat } from '../enums';
|
|
3
3
|
import { Model } from '../Model';
|
|
4
4
|
import { Vector3 } from '../utils';
|
|
5
|
-
import { ClassTypes } from '
|
|
5
|
+
import { ClassTypes } from '../../common/utils/ClassTypes';
|
|
6
6
|
import { BaseEntity } from './BaseEntity';
|
|
7
7
|
export declare class Vehicle extends BaseEntity {
|
|
8
8
|
static getModelDisplayName(vehicleModel: Model): string;
|
package/client/models/Vehicle.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Ped, VehicleDoorCollection, VehicleModCollection, VehicleWheelCollectio
|
|
|
2
2
|
import { VehicleRoofState, VehicleSeat, } from '../enums';
|
|
3
3
|
import { Game } from '../Game';
|
|
4
4
|
import { Vector3 } from '../utils';
|
|
5
|
-
import { ClassTypes } from '
|
|
5
|
+
import { ClassTypes } from '../../common/utils/ClassTypes';
|
|
6
6
|
import { BaseEntity } from './BaseEntity';
|
|
7
7
|
export class Vehicle extends BaseEntity {
|
|
8
8
|
static getModelDisplayName(vehicleModel) {
|
package/common/utils/Vector.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MsgpackBuffer } from '../types';
|
|
2
|
+
import { ClassTypes } from './ClassTypes';
|
|
2
3
|
/**
|
|
3
4
|
* Represents a 2-dimensional vector.
|
|
4
5
|
*/
|
|
@@ -57,7 +58,7 @@ export declare class Vector {
|
|
|
57
58
|
/**
|
|
58
59
|
* The type identifier for vectors.
|
|
59
60
|
*/
|
|
60
|
-
type:
|
|
61
|
+
type: ClassTypes;
|
|
61
62
|
protected static create(x: number, y?: number): Vector2;
|
|
62
63
|
protected static create(x: number, y?: number, z?: number): Vector3;
|
|
63
64
|
protected static create(x: number, y?: number, z?: number, w?: number): Vector4;
|
|
@@ -265,7 +266,7 @@ export declare class Vector {
|
|
|
265
266
|
* Represents a 2-dimensional vector.
|
|
266
267
|
*/
|
|
267
268
|
export declare class Vector2 extends Vector {
|
|
268
|
-
type:
|
|
269
|
+
type: ClassTypes;
|
|
269
270
|
static readonly Zero: Vector2;
|
|
270
271
|
/**
|
|
271
272
|
* Constructs a new 2D vector.
|
|
@@ -278,7 +279,7 @@ export declare class Vector2 extends Vector {
|
|
|
278
279
|
* Represents a 3-dimensional vector.
|
|
279
280
|
*/
|
|
280
281
|
export declare class Vector3 extends Vector implements Vec3 {
|
|
281
|
-
type:
|
|
282
|
+
type: ClassTypes;
|
|
282
283
|
z: number;
|
|
283
284
|
static readonly Zero: Vector3;
|
|
284
285
|
/**
|
|
@@ -301,7 +302,7 @@ export declare class Vector3 extends Vector implements Vec3 {
|
|
|
301
302
|
* Represents a 4-dimensional vector.
|
|
302
303
|
*/
|
|
303
304
|
export declare class Vector4 extends Vector {
|
|
304
|
-
type:
|
|
305
|
+
type: ClassTypes;
|
|
305
306
|
z: number;
|
|
306
307
|
w: number;
|
|
307
308
|
static readonly Zero: Vector4;
|
package/common/utils/Vector.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Adapted from https://raw.githubusercontent.com/you21979/typescript-vector/master/vector3.ts
|
|
2
|
+
import { ClassTypes } from './ClassTypes';
|
|
2
3
|
/**
|
|
3
4
|
* A base vector class inherited by all vector classes.
|
|
4
5
|
*/
|
|
@@ -21,11 +22,11 @@ export class Vector {
|
|
|
21
22
|
: `vec${[x, y, z, w].filter(arg => arg !== undefined).length}`;
|
|
22
23
|
switch (type) {
|
|
23
24
|
default:
|
|
24
|
-
case
|
|
25
|
+
case ClassTypes.Vector2:
|
|
25
26
|
return new Vector2(x, y);
|
|
26
|
-
case
|
|
27
|
+
case ClassTypes.Vector3:
|
|
27
28
|
return new Vector3(x, y, z);
|
|
28
|
-
case
|
|
29
|
+
case ClassTypes.Vector4:
|
|
29
30
|
return new Vector4(x, y, z, w);
|
|
30
31
|
}
|
|
31
32
|
}
|
|
@@ -247,7 +248,7 @@ export class Vector {
|
|
|
247
248
|
/**
|
|
248
249
|
* The type identifier for vectors.
|
|
249
250
|
*/
|
|
250
|
-
this.type =
|
|
251
|
+
this.type = ClassTypes.Vector2;
|
|
251
252
|
}
|
|
252
253
|
*[Symbol.iterator]() {
|
|
253
254
|
yield this.x;
|
|
@@ -375,7 +376,7 @@ export class Vector2 extends Vector {
|
|
|
375
376
|
*/
|
|
376
377
|
constructor(x, y = x) {
|
|
377
378
|
super(2, x, y);
|
|
378
|
-
this.type =
|
|
379
|
+
this.type = ClassTypes.Vector2;
|
|
379
380
|
}
|
|
380
381
|
}
|
|
381
382
|
Vector2.Zero = new Vector2(0, 0);
|
|
@@ -391,7 +392,7 @@ export class Vector3 extends Vector {
|
|
|
391
392
|
*/
|
|
392
393
|
constructor(x, y = x, z = y) {
|
|
393
394
|
super(3, x, y, z);
|
|
394
|
-
this.type =
|
|
395
|
+
this.type = ClassTypes.Vector3;
|
|
395
396
|
this.z = z;
|
|
396
397
|
}
|
|
397
398
|
/**
|
|
@@ -421,7 +422,7 @@ export class Vector4 extends Vector {
|
|
|
421
422
|
*/
|
|
422
423
|
constructor(x, y = x, z = y, w = z) {
|
|
423
424
|
super(4, x, y, z, w);
|
|
424
|
-
this.type =
|
|
425
|
+
this.type = ClassTypes.Vector4;
|
|
425
426
|
this.z = z;
|
|
426
427
|
this.w = w;
|
|
427
428
|
}
|
package/package.json
CHANGED
package/server/Events.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Player } from './entities/Player';
|
|
2
2
|
export type NetEvent = (player: Player, ...args: any[]) => void;
|
|
3
|
+
export type LocalEvent = (...args: any[]) => void;
|
|
3
4
|
export declare class Events {
|
|
4
5
|
static cancel(): void;
|
|
5
6
|
static wasCanceled(): boolean;
|
|
@@ -11,5 +12,5 @@ export declare class Events {
|
|
|
11
12
|
/**
|
|
12
13
|
* An on wrapper that properly converts the classes
|
|
13
14
|
*/
|
|
14
|
-
static on: (eventName: string, event:
|
|
15
|
+
static on: (eventName: string, event: LocalEvent) => void;
|
|
15
16
|
}
|
package/server/Events.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
1
|
import { Ped, Prop, Vehicle, Entity } from './entities';
|
|
3
2
|
import { Player } from './entities/Player';
|
|
4
|
-
import { ClassTypes } from '
|
|
3
|
+
import { ClassTypes } from '../common/utils/ClassTypes';
|
|
5
4
|
import { Vector2, Vector3, Vector4 } from './utils';
|
|
6
5
|
const getClassFromArguments = (...args) => {
|
|
7
6
|
const newArgs = [];
|
|
8
7
|
for (const arg of args) {
|
|
8
|
+
if (!arg.type) {
|
|
9
|
+
newArgs.push(arg);
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
9
12
|
switch (arg.type) {
|
|
10
13
|
case ClassTypes.Vector2: {
|
|
11
14
|
newArgs.push(Vector2.fromObject(arg));
|
|
@@ -71,7 +74,6 @@ Events.onNet = (eventName, event) => {
|
|
|
71
74
|
*/
|
|
72
75
|
Events.on = (eventName, event) => {
|
|
73
76
|
on(eventName, (...args) => {
|
|
74
|
-
|
|
75
|
-
event(ply, ...getClassFromArguments(...args));
|
|
77
|
+
event(...getClassFromArguments(...args));
|
|
76
78
|
});
|
|
77
79
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="@citizenfx/server" />
|
|
2
|
-
import { ClassTypes } from '
|
|
2
|
+
import { ClassTypes } from '../../common/utils/ClassTypes';
|
|
3
3
|
import { eEntityType } from '../enum/eEntityType';
|
|
4
4
|
import { PopulationType } from '../enum/PopulationType';
|
|
5
5
|
import { Hash } from '../type/Hash';
|
package/server/entities/Ped.d.ts
CHANGED
package/server/entities/Ped.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import cfx from '../cfx';
|
|
2
|
-
import { ClassTypes } from '
|
|
2
|
+
import { ClassTypes } from '../../common/utils/ClassTypes';
|
|
3
3
|
import { cleanPlayerName } from '../utils';
|
|
4
4
|
import { Vector3 } from '../utils';
|
|
5
5
|
import { Ped } from './Ped';
|
|
@@ -129,7 +129,6 @@ export class Player {
|
|
|
129
129
|
drop(reason = 'No reason specified') {
|
|
130
130
|
DropPlayer(this.Src, reason);
|
|
131
131
|
}
|
|
132
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
133
132
|
emit(eventName, ...args) {
|
|
134
133
|
TriggerClientEvent(eventName, this.source, ...args);
|
|
135
134
|
}
|
package/server/entities/Prop.js
CHANGED
package/server/enum/index.d.ts
CHANGED
package/server/enum/index.js
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export var ClassTypes;
|
|
2
|
-
(function (ClassTypes) {
|
|
3
|
-
ClassTypes[ClassTypes["Ped"] = 0] = "Ped";
|
|
4
|
-
ClassTypes[ClassTypes["Prop"] = 1] = "Prop";
|
|
5
|
-
ClassTypes[ClassTypes["Vehicle"] = 2] = "Vehicle";
|
|
6
|
-
ClassTypes[ClassTypes["Entity"] = 3] = "Entity";
|
|
7
|
-
ClassTypes[ClassTypes["Player"] = 4] = "Player";
|
|
8
|
-
ClassTypes[ClassTypes["Vector2"] = 5] = "Vector2";
|
|
9
|
-
ClassTypes[ClassTypes["Vector3"] = 6] = "Vector3";
|
|
10
|
-
ClassTypes[ClassTypes["Vector4"] = 7] = "Vector4";
|
|
11
|
-
ClassTypes[ClassTypes["Quanterion"] = 8] = "Quanterion";
|
|
12
|
-
})(ClassTypes || (ClassTypes = {}));
|
|
File without changes
|
|
File without changes
|