@gta5urban/types-server 2.1.9

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/index.d.ts ADDED
@@ -0,0 +1,1934 @@
1
+ /// <reference path="enums.d.ts" />
2
+ /// <reference path="./hashes/ped_hashes.d.ts" />
3
+ /// <reference path="./hashes/vehicle_hashes.d.ts" />
4
+ /// <reference path="./hashes/weapon_hashes.d.ts" />
5
+
6
+ declare type HashOrNumberOrString<T> = T | number | string;
7
+ declare type HashOrString<T> = T | string;
8
+ declare type Array2d = [number, number];
9
+ declare type Array3d = [number, number, number];
10
+ declare type Array4d = [number, number, number, number];
11
+ declare type RGB = Array3d;
12
+ declare type RGBA = Array4d;
13
+
14
+ declare type KeyValueCollection = { [key: string]: any };
15
+
16
+ declare interface IVector3 {
17
+ x: number;
18
+ y: number;
19
+ z: number;
20
+ }
21
+
22
+ declare type PlayerWeaponCollection = {
23
+ current: number;
24
+ reset(): void;
25
+ };
26
+
27
+ declare class Vector3 {
28
+ public x: number;
29
+ public y: number;
30
+ public z: number;
31
+
32
+ constructor(x: number, y: number, z: number);
33
+ constructor(arr: Array3d);
34
+ constructor(obj: IVector3);
35
+
36
+ /**
37
+ * Add a Vector3 to another Vector3 or scalar
38
+ *
39
+ * @param otherVec Vector3 or number: The vector or scalar to be added to the callee.
40
+ */
41
+ add(otherVec: Vector3 | number): Vector3;
42
+
43
+ /**
44
+ * Get the angle (in radians) between two vectors.
45
+ *
46
+ * @param otherVec the other vector to calculate the angle to.
47
+ * @returns The angle (in radians) between two vectors.
48
+ */
49
+ angleTo(otherVec: Vector3): number;
50
+
51
+ /**
52
+ * Clone a vector
53
+ *
54
+ * @returns A copy of a Vector3
55
+ */
56
+ clone(): Vector3;
57
+
58
+ /**
59
+ * Calculate the cross-product of two vectors.
60
+ * The cross-product is a vector that is perpendicular to both input vectors.
61
+ *
62
+ * @param otherVec The other vector.
63
+ */
64
+ cross(otherVec: Vector3): Vector3;
65
+
66
+ /**
67
+ * Divide a Vector3 by another Vector3 or scalar.
68
+ *
69
+ * @param otherVec The vector or scalar to divide the callee by.
70
+ */
71
+ divide(otherVec: Vector3 | number): Vector3;
72
+
73
+ /**
74
+ * Calculate the dot product of two vectors.
75
+ *
76
+ * @param otherVec The other vector.
77
+ */
78
+ dot(otherVec: Vector3): number;
79
+
80
+ /**
81
+ * Test where two Vector3s equal each other.
82
+ *
83
+ * @param otherVec The vector to compare to the callee.
84
+ */
85
+ equals(otherVec: Vector3): boolean;
86
+
87
+ /**
88
+ * Get the magnitude of a Vector3
89
+ *
90
+ * @returns The magnitude of a Vector3
91
+ */
92
+ length(): number;
93
+
94
+ /**
95
+ * Get the maximum partial of a Vector3
96
+ *
97
+ * @returns The maximum partial of a Vector3
98
+ */
99
+ max(): number;
100
+
101
+ /**
102
+ * Get the minimum partial of a Vector3
103
+ *
104
+ * @returns The minimum partial of a Vector3
105
+ */
106
+ min(): number;
107
+
108
+ /**
109
+ * Multiply a Vector3 by another Vector3 or scalar.
110
+ *
111
+ * @param otherVec The vector or scalar to be added to the callee.
112
+ */
113
+ multiply(otherVec: Vector3 | number): Vector3;
114
+
115
+ /**
116
+ * Get the opposite of a Vector3 by flipping the sign of each partial.
117
+ *
118
+ * @returns The opposite of a Vector3 by flipping the sign of each partial
119
+ */
120
+ negative(): Vector3;
121
+
122
+ /**
123
+ * Subtract a Vector3 or scalar from another Vector3.
124
+ *
125
+ * @param otherVec The vector or scalar to be subtracted from the callee.
126
+ */
127
+ subtract(otherVec: Vector3 | number): Vector3;
128
+
129
+ /**
130
+ * TODO: docs
131
+ */
132
+ toAngles(): Array2d;
133
+
134
+ /**
135
+ * Get an array of the partials of a Vector3.
136
+ *
137
+ * @returns An array of the partials of a Vector3
138
+ */
139
+ toArray(): Array3d;
140
+
141
+ /**
142
+ * Normalized copy of a Vector3 that has the same direction but with a magnitude of 1.
143
+ *
144
+ * @returns Normalized copy of a Vector3 that has the same direction but with a magnitude of 1.
145
+ */
146
+ unit(): Vector3;
147
+ }
148
+
149
+ declare class EntityMp {
150
+ /**
151
+ * Property used for getting an entity ID.
152
+ *
153
+ * The ID is a unique identifier for the entity.
154
+ *
155
+ * A server-side ID is NOT the same as a client-side ID.
156
+ *
157
+ * Use [remoteId](https://wiki.rage.mp/index.php?title=Entity::remoteId) property if you want it to match the server-side ID.
158
+ */
159
+ public readonly id: number;
160
+
161
+ /**
162
+ * Property used for getting an entity type.
163
+ */
164
+ public readonly type: RageEnums.EntityType;
165
+
166
+ /**
167
+ * Property used to gets/sets the entity's alpha.
168
+ */
169
+ public alpha: number;
170
+
171
+ /**
172
+ * Property used to gets/sets the entity's data.
173
+ */
174
+ public data: any;
175
+
176
+ /**
177
+ * Property used to gets/sets the entity's dimension.
178
+ *
179
+ * The dimension determines who the entity is visible to.
180
+ */
181
+ public dimension: number;
182
+
183
+ /**
184
+ * Property used to gets/sets the entity's model.
185
+ */
186
+ public model: number;
187
+
188
+ /**
189
+ * Property used to gets/sets the entity's position.
190
+ */
191
+ public position: Vector3;
192
+
193
+ /**
194
+ * Retrieves the custom data from the entity.
195
+ *
196
+ * @param name The variabile name
197
+ */
198
+ public getVariable<T = any>(name: string): T | null;
199
+
200
+ /**
201
+ * Allows to get the value set with [entity.setOwnVariable(key, value)](https://wiki.rage.mp/index.php?title=Entity::setOwnVariable).
202
+ *
203
+ * @param name The variabile name
204
+ */
205
+ public getOwnVariable<T = any>(name: string): T | null;
206
+
207
+ /**
208
+ * Set custom data to an entity.
209
+ *
210
+ * @param name The variabile name
211
+ * @param value The value
212
+ */
213
+ public setVariable(name: string, value: any): void;
214
+
215
+ /**
216
+ * Set multiple custom data variables to an entity.
217
+ *
218
+ * @param values The values
219
+ */
220
+ public setVariables(values: KeyValueCollection): void;
221
+
222
+ /**
223
+ * Sets the data available to the player as opposed to [entity.setVariable(key, value)](https://wiki.rage.mp/index.php?title=Entity::setVariable).
224
+ */
225
+ public setOwnVariable(key: string, value: any): void;
226
+
227
+ /**
228
+ * Set multiple custom data variables that will be only available to an entity.
229
+ */
230
+ public setOwnVariables(values: KeyValueCollection): void;
231
+
232
+ /**
233
+ * Gets the distance between two entities.
234
+ *
235
+ * @param position Vector3
236
+ */
237
+ public dist(position: Vector3): number;
238
+
239
+ /**
240
+ * Gets the squared distance between two entities.
241
+ *
242
+ * @param position Vector3
243
+ */
244
+ public distSquared(position: Vector3): number;
245
+
246
+ /**
247
+ * Destroy a created entity.
248
+ */
249
+ public destroy(): void;
250
+ }
251
+
252
+ declare class EntityMpPool<T> {
253
+ /**
254
+ * Property used to get the element to count of a pool.
255
+ */
256
+ public readonly length: number;
257
+
258
+ /**
259
+ * Property used to get an element pool size.
260
+ *
261
+ * Useful to be used in explicit array size declaration or manual for loop size (non [foreach](https://wiki.rage.mp/index.php?title=Pool::forEach)).
262
+ */
263
+ public readonly size: number;
264
+
265
+ /**
266
+ * TODO: docs
267
+ */
268
+ public apply(callingFunction: (...args: any[]) => void, ...args: any[]): void;
269
+
270
+ /**
271
+ * Used to get an element from a pool at an ID.
272
+ *
273
+ * @param id Element ID, what you need get from the pool.
274
+ * @returns An element from a pool at an ID
275
+ */
276
+ public at(id: number): T;
277
+
278
+ /**
279
+ * Used for check, exists entity with ID in pool or not.
280
+ *
281
+ * @param entity Entity ID or the entity itself, what you want to check in pool.
282
+ */
283
+ public exists(entity: T | number): boolean;
284
+
285
+ /**
286
+ * Used for calling a function for each element in a pool.
287
+ *
288
+ * @param callingFunction Function what will be called
289
+ */
290
+ public forEach(callingFunction: (entity: T) => void): void;
291
+
292
+ /**
293
+ * Calling for each entity in a pool.
294
+ *
295
+ * Same as forEach except faster at lookups.
296
+ * Do not use this for destroying entities.
297
+ *
298
+ * @param callingFunction Function what will be called
299
+ */
300
+ public forEachFast(callingFunction: (entity: T) => void): void;
301
+
302
+ /**
303
+ * Used to call a function for each element in the pool.
304
+ *
305
+ * @param dimension Dimension
306
+ * @param callingFunction Function, what will be called.
307
+ */
308
+ public forEachInDimension(dimension: number, callingFunction: (entity: T) => void): void;
309
+
310
+ /**
311
+ * Used for calling a function for each element in a pool, but only if it in range of position.
312
+ *
313
+ * @param {Vector3} position - The position to check against.
314
+ * @param {number} range - The range within which elements will be processed.
315
+ * @param {function} callingFunction - The function to be called for each element.
316
+ */
317
+ public forEachInRange(position: Vector3, range: number, callingFunction: (entity: T) => void): void;
318
+ public forEachInRange(position: Vector3, range: number, dimension: number, callingFunction: (entity: T) => void): void;
319
+
320
+ /**
321
+ * Gets the closest set of entities to a position.
322
+ *
323
+ * @param position Vector3
324
+ * @param limit Limit of results
325
+ * @returns Array of entities sorted by distance to given position
326
+ *
327
+ * @example
328
+ * ```
329
+ * const [closestVehicle] = mp.vehicles.getClosest(player.position, 1);
330
+ * closestVehicle.locked = true;
331
+ * ```
332
+ */
333
+ public getClosest(position: Vector3, limit: number): T[];
334
+
335
+ /**
336
+ * Gets the closest set of entities to a position in the defined dimension.
337
+ *
338
+ * @param position Vector3
339
+ * @param dimension The Dimension
340
+ * @param limit Limit of results
341
+ * @returns Array of entities sorted by distance to given position
342
+ *
343
+ * @example
344
+ * ```
345
+ * const [closestVehicle] = mp.vehicles.getClosestInDimension(player.position, player.dimension, 1);
346
+ * closestVehicle.locked = true;
347
+ * ```
348
+ */
349
+ public getClosestInDimension(position: Vector3, dimension: number, limit: number): T[];
350
+
351
+ /**
352
+ * Converts a pool to an array.
353
+ *
354
+ */
355
+ public toArray(): T[];
356
+ }
357
+
358
+ declare class PlayerMp extends EntityMp {
359
+ /**
360
+ * Property used for getting the player's action.
361
+ */
362
+ public readonly action: string;
363
+
364
+ /**
365
+ * Property used for getting the player's aim target
366
+ *
367
+ * If player currently [isn't aiming](https://wiki.rage.mp/index.php?title=Player::isAiming), this property will be last aim target.
368
+ */
369
+ public readonly aimTarget: PlayerMp;
370
+
371
+ /**
372
+ * Property used for getting the player's weapon hash and ammo.
373
+ */
374
+ public readonly allWeapons: Record<number, number>;
375
+
376
+ /**
377
+ * Property used for getting the player's ip address.
378
+ */
379
+ public readonly ip: string;
380
+
381
+ /**
382
+ * Property used for getting the player's aiming state.
383
+ */
384
+ public readonly isAiming: boolean;
385
+
386
+ /**
387
+ * Property used for getting the player's climbing state.
388
+ */
389
+ public readonly isClimbing: boolean;
390
+
391
+ /**
392
+ * Property used for getting the player's entering vehicle state.
393
+ */
394
+ public readonly isEnteringVehicle: boolean;
395
+
396
+ /**
397
+ * Property used for getting the player's cover state.
398
+ */
399
+ public readonly isInCover: boolean;
400
+
401
+ /**
402
+ * Property used for getting the player's melee state.
403
+ */
404
+ public readonly isInMelee: boolean;
405
+
406
+ /**
407
+ * Property used for getting the player's jumping state.
408
+ */
409
+ public readonly isJumping: boolean;
410
+
411
+ /**
412
+ * Property used for getting the player's leaving vehicle state.
413
+ */
414
+ public readonly isLeavingVehicle: boolean;
415
+
416
+ /**
417
+ * Property used for getting the player's on ladder state.
418
+ */
419
+ public readonly isOnLadder: boolean;
420
+
421
+ /**
422
+ * Property used for getting the player's reloading state.
423
+ */
424
+ public readonly isReloading: boolean;
425
+
426
+ /**
427
+ * Property used for getting the player's primary hair color.
428
+ */
429
+ public readonly hairColor: number;
430
+
431
+ /**
432
+ * Property used for getting the player's hair highlight color.
433
+ */
434
+ public readonly hairHighlightColor: number;
435
+
436
+ /**
437
+ * Property used for getting the player's packet loss.
438
+ */
439
+ public readonly packetLoss: number;
440
+
441
+ /**
442
+ * Property used for getting the player's ping.
443
+ */
444
+ public readonly ping: number;
445
+
446
+ /**
447
+ * Property used for getting the player's social club id.
448
+ */
449
+ public readonly rgscId: string;
450
+
451
+ /**
452
+ * Property used for getting the player's vehicle seat.
453
+ */
454
+ public readonly seat: RageEnums.VehicleSeat;
455
+
456
+ /**
457
+ * Property used for getting the player's client serial.
458
+ */
459
+ public readonly serial: string;
460
+
461
+ /**
462
+ * Property used for getting the player's social club.
463
+ */
464
+ public readonly socialClub: string;
465
+
466
+ /**
467
+ * Property used for getting the player's streamed players.
468
+ */
469
+ public readonly streamedPlayers: PlayerMp[];
470
+
471
+ /**
472
+ * Property used for getting the player's weapons.
473
+ */
474
+ public readonly weapons: PlayerWeaponCollection;
475
+
476
+ /**
477
+ * Property used for getting the player's vehicle.
478
+ */
479
+ public readonly vehicle: VehicleMp;
480
+
481
+ /**
482
+ * Property used for getting the player's voice listeners.
483
+ *
484
+ * @returns {PlayerMp[]} All active voice listeners as an array,
485
+ * which got added by [Player::enableVoiceTo](https://wiki.rage.mp/index.php?title=Player::enableVoiceTo).
486
+ */
487
+ public readonly voiceListeners: PlayerMp[];
488
+
489
+ /**
490
+ * Property used to gets/sets the player's armor.
491
+ */
492
+ public armour: number;
493
+
494
+ /**
495
+ * Property used to gets/sets the player's eye color.
496
+ */
497
+ public eyeColor: number;
498
+
499
+ /**
500
+ * Property used to gets/sets the player's game type.
501
+ */
502
+ public gameType: string;
503
+
504
+ /**
505
+ * Property used to gets/sets the player's heading.
506
+ */
507
+ public heading: number;
508
+
509
+ /**
510
+ * Property used to gets/sets the player's health.
511
+ */
512
+ public health: number;
513
+
514
+ /**
515
+ * Property used to gets/sets the player's name.
516
+ */
517
+ public name: string;
518
+
519
+ /**
520
+ * Property used to gets/sets the player's weapon.
521
+ */
522
+ public weapon: number;
523
+
524
+ /**
525
+ * Property used to gets/sets the player's weapon ammo.
526
+ */
527
+ public weaponAmmo: number;
528
+
529
+ /**
530
+ * Property used to gets/sets the player's outgoing sync.
531
+ */
532
+ public disableOutgoingSync: boolean;
533
+
534
+ /**
535
+ * Bans the player from your server.
536
+ *
537
+ * The ban reason doesn't display for the player, you need to use something else to display it for the player.
538
+ *
539
+ * Also, all bans that use this function are cleared once the server restarts.
540
+ *
541
+ * You need to save the bans yourself if you want them to stay after restarting your server.
542
+ * @param reason The reason of ban
543
+ */
544
+ public ban(reason: string): void;
545
+
546
+ /**
547
+ * `FROM SERVER` Calls a client-side event for the selected player
548
+ *
549
+ * `FROM CLIENT` For Peer 2 Peer connections.
550
+ *
551
+ * The current client can call an event on another client's scriptside, and that other client can handle that event.
552
+ *
553
+ * @param eventName The event name that will be called
554
+ * @param args Any arguments, what should be sent to the client.
555
+ * Supports entities, strings, numbers and booleans.
556
+ * (Objects and Arrays should be packed to JSON format.) Arguments has to be packed in an array.
557
+ */
558
+ public call(eventName: string, args?: any[]): void;
559
+
560
+ /**
561
+ * Calls the specified player's clientside Remote procedure call (RPC) event and expects a callback.
562
+ *
563
+ * @param eventName
564
+ * @param args Args
565
+ */
566
+ public callProc<T = any>(eventName: string, args?: any[]): Promise<T>;
567
+
568
+ /**
569
+ * Triggers a client-side event for the selected player unreliably,
570
+ * which means it will be affected by potential packet loss,
571
+ * but it will be triggered way faster, useful for when you need frequent triggers.
572
+ *
573
+ * @param eventName Event Name
574
+ * @param args Args
575
+ */
576
+ public callUnreliable(eventName: string, args?: any[]): void;
577
+
578
+ /**
579
+ * TODO: docs
580
+ */
581
+ public cancelPendingProc(procName?: string): void;
582
+
583
+ /**
584
+ * TODO: docs
585
+ */
586
+ public clearDecorations(): void;
587
+
588
+ /**
589
+ * Enables voice listening to a certain player.
590
+ *
591
+ * @param targetPlayer The Player you want to listen to.
592
+ */
593
+ public enableVoiceTo(targetPlayer: PlayerMp): void;
594
+
595
+ /**
596
+ * Disables voice listening to a certain player.
597
+ *
598
+ * @param targetPlayer The Player you want to stop listen to.
599
+ */
600
+ public disableVoiceTo(targetPlayer: PlayerMp): void;
601
+
602
+ /**
603
+ * TODO: docs
604
+ */
605
+ public eval(code: string): void;
606
+
607
+ /**
608
+ * Gets a hash of player clothes.
609
+ *
610
+ * @param {RageEnums.ClothesComponent | number} component - [Components](https://wiki.rage.mp/index.php?title=Player::getClothes)
611
+ * @returns A hash of player clothes
612
+ */
613
+ public getClothes(component: RageEnums.ClothesComponent | number): {
614
+ drawable: number;
615
+ texture: number;
616
+ palette: number;
617
+ };
618
+
619
+ /**
620
+ * Gets the tattoo (decoration) from a collection specified.
621
+ *
622
+ * @param collection - [Collections](https://github.com/root-cause/v-tattoos)
623
+ */
624
+ public getDecoration(collection: number): number;
625
+
626
+ /**
627
+ * Gets the various freemode face features, e.g., nose length, chin shape.
628
+ * Scale ranges from -1.0 to 1.0.
629
+ * Index can be 0 - 19.
630
+ *
631
+ * @param {number} index - [Index](https://wiki.rage.mp/index.php?title=Player::getFaceFeature)
632
+ */
633
+ public getFaceFeature(index: number): number;
634
+
635
+ /**
636
+ * TODO: docs
637
+ */
638
+ public getHeadBlend(): {
639
+ shapes: number[];
640
+ skins: number[];
641
+ shapeMix: number;
642
+ skinMix: number;
643
+ thirdMix: number;
644
+ };
645
+
646
+ /**
647
+ * TODO: docs
648
+ */
649
+ public getHeadOverlay(overlay: RageEnums.HeadOverlay | number): Array4d;
650
+
651
+ /**
652
+ * Gets a prop of player from ID.
653
+ *
654
+ * @param prop - [Props](https://wiki.rage.mp/index.php?title=Player::getProp)
655
+ * @returns A prop of player from ID
656
+ */
657
+ public getProp(prop: RageEnums.PlayerProp | number): {
658
+ drawable: number;
659
+ texture: number;
660
+ };
661
+
662
+ /**
663
+ * Get the weapon's ammo.
664
+ *
665
+ * @param weapon Weapon Hash
666
+ */
667
+ public getWeaponAmmo(weapon: HashOrNumberOrString<RageEnums.Hashes.Weapon>): number;
668
+
669
+ /**
670
+ * Gives a weapon(see) for the player.
671
+ *
672
+ * @param weaponHash Weapon Hash
673
+ * @param ammo Ammo
674
+ */
675
+ public giveWeapon(weaponHash: HashOrNumberOrString<RageEnums.Hashes.Weapon>, ammo: number): void;
676
+ public giveWeapon(weaponHashes: HashOrNumberOrString<RageEnums.Hashes.Weapon>[], ammo: number): void;
677
+
678
+ /**
679
+ * TODO: docs
680
+ */
681
+ public hasPendingProc(procName?: string): boolean;
682
+
683
+ /**
684
+ * Used for check, player is located in stream distance for another player or not.
685
+ *
686
+ * @param player Player
687
+ */
688
+ public isStreamed(player: PlayerMp): boolean;
689
+
690
+ /**
691
+ * Invokes specified [native](https://cdn.rage.mp/public/natives/) function
692
+ *
693
+ * @param hash Hash
694
+ * @param args Args
695
+ */
696
+ public invoke(hash: string, ...args: any[]): void;
697
+
698
+ /**
699
+ * Kicks a player from the server.
700
+ *
701
+ * @param reason This message does not show up for the player being kicked
702
+ */
703
+ public kick(reason: string): void;
704
+
705
+ /**
706
+ * Silently kicks the player which will then reconnect them back to the server.
707
+ *
708
+ * Useful for quick reconnecting without going through the UI.
709
+ *
710
+ * The client will act as if it has timed out.
711
+ */
712
+ public kickSilent(): void;
713
+
714
+ /**
715
+ * Sends a notification to the player.
716
+ *
717
+ * You can use the color codes found here: [Fonts and colors](https://wiki.rage.mp/index.php?title=Fonts_and_Colors)
718
+ *
719
+ * @param message Message
720
+ */
721
+ public notify(message: string): void;
722
+
723
+ /**
724
+ * Writes a chat message to player.
725
+ *
726
+ * @param message Text what should be output in player chat.
727
+ */
728
+ public outputChatBox(message: string): void;
729
+
730
+ /**
731
+ * Starts animation
732
+ *
733
+ * @param dict - [Animation List](https://wiki.rage.mp/index.php?title=Animations)
734
+ * @param name Animation Name
735
+ * @param speed Animation Speed
736
+ * @param flag - [Animation Flags](https://wiki.rage.mp/index.php?title=Player::playAnimation)
737
+ */
738
+ public playAnimation(dict: string, name: string, speed: number, flag: number): void;
739
+
740
+ /**
741
+ * Stops animation of the player
742
+ */
743
+ public stopAnimation(): void;
744
+
745
+ /**
746
+ * Puts player into vehicle.
747
+ *
748
+ * You can't put player in vehicle immediately after creating vehicle, use timeout (200 ms will be fine)
749
+ *
750
+ * @param vehicle Vehicle
751
+ * @param seat Seat Number
752
+ */
753
+ public putIntoVehicle(vehicle: VehicleMp, seat: RageEnums.VehicleSeat | number): void;
754
+
755
+ /**
756
+ * Removes all weapons from the player
757
+ */
758
+ public removeAllWeapons(): void;
759
+
760
+ /**
761
+ * Ejects player from vehicle.
762
+ */
763
+ public removeFromVehicle(): void;
764
+
765
+ /**
766
+ * Removes a weapon of player. Weapon's hashes list
767
+ *
768
+ * @param weaponHash - [Weapon Hash](https://wiki.rage.mp/index.php?title=Weapons)
769
+ */
770
+ public removeWeapon(weaponHash: HashOrNumberOrString<RageEnums.Hashes.Weapon>): void;
771
+
772
+ /**
773
+ * Sets clothing for player.
774
+ *
775
+ * Alternative of client-side function: [Player::setComponentVariation](https://wiki.rage.mp/index.php?title=Player::setComponentVariation)
776
+ *
777
+ * @param component ClothesComponent
778
+ * @param drawable Number
779
+ * @param texture Texture
780
+ * @param palette Palette
781
+ */
782
+ public setClothes(component: RageEnums.ClothesComponent | number, drawable: number, texture: number, palette: number): void;
783
+
784
+ /**
785
+ * Sets player customization (NB: This resets your weapons also).
786
+ *
787
+ * IMPORTANT! faceFeatures array must contain 20 elements
788
+ */
789
+ public setCustomization(
790
+ gender: boolean,
791
+ shapeFirst: number,
792
+ shapeSecond: number,
793
+ shapeThird: number,
794
+ skinFirst: number,
795
+ skinSecond: number,
796
+ skinThird: number,
797
+ shapeMix: number,
798
+ skinMix: number,
799
+ thirdMix: number,
800
+ eyeColor: number,
801
+ hairColor: number,
802
+ hightlightColor: number,
803
+ faceFeatures: number[]
804
+ ): void;
805
+
806
+ /**
807
+ * Applies an Item from a PedDecorationCollection to a player. These include tattoos and shirt decals.
808
+ *
809
+ * @param collection Model hash or name
810
+ * @param overlay Model hash or name
811
+ */
812
+ public setDecoration(collection: number, overlay: number): void;
813
+
814
+ /**
815
+ * Sets the various freemode face features, e.g., nose length, chin shape.
816
+ * Scale ranges from -1.0 to 1.0.
817
+ * Index can be 0 - 19.
818
+ */
819
+ public setFaceFeature(index: number, scale: number): void;
820
+
821
+ /**
822
+ * Used for freemode (online) characters.
823
+ *
824
+ * @param firstColor First Color
825
+ * @param secondColor Second Color
826
+ */
827
+ public setHairColor(firstColor: number, secondColor: number): void;
828
+
829
+ /**
830
+ * TODO: docs
831
+ */
832
+ public setHeadBlend(
833
+ shapeFirst: number,
834
+ shapeSecond: number,
835
+ shapeThird: number,
836
+ skinFirst: number,
837
+ skinSecond: number,
838
+ skinThird: number,
839
+ shapeMix: number,
840
+ skinMix: number,
841
+ thirdMix: number
842
+ ): void;
843
+
844
+ /**
845
+ * OverlayID ranges from 0 to 12, index from 0 to _GET_NUM_OVERLAY_VALUES(overlayID)-1, and opacity from 0.0 to 1.0.
846
+ *
847
+ * First and second color you can take in the list of hair colors.
848
+ *
849
+ * [List of colors](https://wiki.gtanet.work/index.php?title=Hair_Colors)
850
+ *
851
+ * To disable any overlay, use 255 as index.
852
+ */
853
+ public setHeadOverlay(overlay: RageEnums.HeadOverlay | number, value: Array4d): void;
854
+
855
+ /**
856
+ * Sets the prop for the player
857
+ */
858
+ public setProp(prop: RageEnums.PlayerProp | number, drawable: number, texture: number): void;
859
+
860
+ /**
861
+ * Sets the amount of ammo for the selected weapon
862
+ *
863
+ * @param weapon Weapon Hash
864
+ * @param ammo Ammo
865
+ */
866
+ public setWeaponAmmo(weapon: HashOrNumberOrString<RageEnums.Hashes.Weapon>, ammo: number): void;
867
+
868
+ /**
869
+ * Spawns the player.
870
+ *
871
+ * @param position Vector3
872
+ */
873
+ public spawn(position: Vector3): void;
874
+
875
+ /**
876
+ * Updates the player head blend data
877
+ */
878
+ public updateHeadBlend(shapeMix: number, skinMix: number, thirdMix: number): void;
879
+
880
+ /**
881
+ * Makes the player play a scenario.
882
+ *
883
+ * @param scenario - [Scenario List](https://wiki.rage.mp/index.php?title=Scenarios)
884
+ */
885
+ public playScenario(scenario: string): void;
886
+
887
+ /**
888
+ * Calls all streamed in players' clientside from the specified player passing data.
889
+ *
890
+ * @param includeSelf Calls the specified player's clientside also along with the streamed players to him
891
+ * @param eventName Event Name
892
+ * @param args Args
893
+ */
894
+ public callToStreamed(includeSelf: boolean, eventName: string, args?: any[]): void;
895
+ }
896
+
897
+ declare class PlayerMpPool extends EntityMpPool<PlayerMp> {
898
+ /**
899
+ * Writes a chat message for all players (like [Player::outputChatBox](https://wiki.rage.mp/index.php?title=Player::outputChatBox)).
900
+ *
901
+ * @param text The text to be sent
902
+ */
903
+ public broadcast(text: string): void;
904
+
905
+ /**
906
+ * Writes a chat message for all players in range (like [Player::outputChatBox](https://wiki.rage.mp/index.php?title=Player::outputChatBox)).
907
+ *
908
+ * @param position The position from which the broadcast will be sent
909
+ * @param range The range from position
910
+ * @param dimension The dimension in which the broadcast will be sent (optional)
911
+ * @param text The text to be sent
912
+ */
913
+ public broadcastInRange(position: Vector3, range: number, text: string): void;
914
+ public broadcastInRange(position: Vector3, range: number, dimension: number, text: string): void;
915
+
916
+ /**
917
+ * Triggers an event for:
918
+ *
919
+ * - the whole server
920
+ * - specified players array
921
+ *
922
+ * @param eventName Event name, what will be called
923
+ * @param args Any arguments, what should be sent to the client.
924
+ * Supports entities, strings, numbers and booleans.
925
+ * (Objects and Arrays should be packed to JSON format.)
926
+ */
927
+ public call(eventName: string, args?: any[]): void;
928
+ public call(players: PlayerMp[], eventName: string, args?: any[]): void;
929
+
930
+ /**
931
+ * Calls added client-side event for any players in a specific dimension
932
+ *
933
+ * @param dimension The dimension in which the event will be sent
934
+ * @param eventName Event name, what will be called
935
+ * @param args Any arguments, what should be sent to the client.
936
+ * Supports entities, strings, numbers and booleans.
937
+ * (Objects and Arrays should be packed to JSON format.)
938
+ */
939
+ public callInDimension(dimension: number, eventName: string, args?: any[]): void;
940
+
941
+ /**
942
+ * Calls a function for each player in range of position.
943
+ *
944
+ * @param position The position from which the broadcast will be sent
945
+ * @param range The range from position
946
+ * @param eventName Event name, what will be called
947
+ * @param args Any arguments, what should be sent to the client.
948
+ * Supports entities, strings, numbers and booleans.
949
+ * (Objects and Arrays should be packed to JSON format.)
950
+ */
951
+ public callInRange(position: Vector3, range: number, eventName: string, args?: any[]): void;
952
+ public callInRange(position: Vector3, range: number, dimension: number, eventName: string, args?: any[]): void;
953
+
954
+ /**
955
+ * TODO: docs
956
+ */
957
+ public callUnreliable(eventName: string, args?: any[]): void;
958
+ public callUnreliable(players: PlayerMp[], eventName: string, args?: any[]): void;
959
+
960
+ /**
961
+ * TODO: docs
962
+ */
963
+ public callInDimensionUnreliable(dimension: number, eventName: string, args?: any[]): void;
964
+
965
+ /**
966
+ * TODO: docs
967
+ */
968
+ public callInRangeUnreliable(position: Vector3, range: number, eventName: string, args?: any[]): void;
969
+ public callInRangeUnreliable(position: Vector3, range: number, dimension: number, eventName: string, args?: any[]): void;
970
+ }
971
+
972
+ declare type Quaternion = {
973
+ x: number;
974
+ y: number;
975
+ z: number;
976
+ w: number;
977
+ };
978
+
979
+ declare class VehicleMp extends EntityMp {
980
+ /**
981
+ * Property used for getting the vehicle's extras
982
+ */
983
+ public readonly extras: boolean[];
984
+
985
+ /**
986
+ * Property used for getting the vehicle's mods
987
+ */
988
+ public readonly mods: number[];
989
+
990
+ /**
991
+ * Property used for getting the engine's health.
992
+ *
993
+ * For edit health use [Vehicle::repair](https://wiki.rage.mp/index.php?title=Vehicle::repair)
994
+ */
995
+ public readonly engineHealth: number;
996
+
997
+ /**
998
+ * Property used for getting the brake's state.
999
+ */
1000
+ public readonly brake: boolean;
1001
+
1002
+ /**
1003
+ * Property used for getting the highbeams's state.
1004
+ */
1005
+ public readonly highbeams: boolean;
1006
+
1007
+ /**
1008
+ * Property used for getting the horn's state.
1009
+ */
1010
+ public readonly horn: boolean;
1011
+
1012
+ /**
1013
+ * Property used for getting the rocket boost's state.
1014
+ */
1015
+ public readonly rocketBoost: boolean;
1016
+
1017
+ /**
1018
+ * Property used for getting the siren's state.
1019
+ */
1020
+ public readonly siren: boolean;
1021
+
1022
+ /**
1023
+ * Property used for getting the steer angle's state.
1024
+ *
1025
+ * From -1 to 1
1026
+ */
1027
+ public readonly steerAngle: number;
1028
+ /**
1029
+ * Property used for getting the vehicle velocity.
1030
+ */
1031
+ public readonly velocity: Vector3;
1032
+
1033
+ /**
1034
+ * Property used for getting the vehicle's streamed players
1035
+ */
1036
+ public readonly streamedPlayers: PlayerMp[];
1037
+
1038
+ /**
1039
+ * Property used for getting the vehicle's heading.
1040
+ */
1041
+ public readonly heading: number;
1042
+
1043
+ /**
1044
+ * Property used for getting the vehicle's quaternion.
1045
+ */
1046
+ public readonly quaternion: Quaternion;
1047
+
1048
+ /**
1049
+ * Property used for getting the vehicle's trailer
1050
+ */
1051
+ public readonly trailer: VehicleMp;
1052
+
1053
+ /**
1054
+ * Property used for getting the vehicle's trailered by
1055
+ */
1056
+ public readonly traileredBy: VehicleMp;
1057
+
1058
+ /**
1059
+ * Property used to gets/sets the vehicle's rotation.
1060
+ */
1061
+ public rotation: Vector3;
1062
+
1063
+ /**
1064
+ * Property used to gets/sets the body's health.
1065
+ */
1066
+ public bodyHealth: number;
1067
+
1068
+ /**
1069
+ * Property used to gets/sets the vehicle's controller.
1070
+ */
1071
+ public controller: PlayerMp | undefined;
1072
+
1073
+ /**
1074
+ * Property used to gets/sets the vehicle's custom tires.
1075
+ */
1076
+ public customTires: boolean;
1077
+
1078
+ /**
1079
+ * Property used for getting the vehicle's engine status.
1080
+ */
1081
+ public engine: boolean;
1082
+
1083
+ /**
1084
+ * Property used to gets/sets the vehicle's dashboard color.
1085
+ */
1086
+ public dashboardColor: number;
1087
+
1088
+ /**
1089
+ * Property used to gets/sets the vehicle's dead state.
1090
+ */
1091
+ public dead: boolean;
1092
+
1093
+ /**
1094
+ * Property used to gets/sets the vehicle's livery
1095
+ */
1096
+ public livery: number;
1097
+
1098
+ /**
1099
+ * Property used to gets/sets the vehicle's lock state
1100
+ */
1101
+ public locked: boolean;
1102
+
1103
+ /**
1104
+ * Property used to gets/sets the vehicle's movable state.
1105
+ */
1106
+ public movable: boolean;
1107
+
1108
+ /**
1109
+ * Property used for getting the vehicle's neon status.
1110
+ */
1111
+ public neonEnabled: boolean;
1112
+
1113
+ /**
1114
+ * Property used to gets/sets the vehicle's number plate
1115
+ *
1116
+ * Maximum length: 8 char
1117
+ */
1118
+ public numberPlate: string;
1119
+
1120
+ /**
1121
+ * Property used to gets/sets the vehicle's number plate type
1122
+ */
1123
+ public numberPlateType: RageEnums.VehicleNumberPlateType;
1124
+
1125
+ /**
1126
+ * Property used to gets/sets the vehicle's pearlescent color
1127
+ *
1128
+ * Using the [Vehicle colors](https://wiki.rage.mp/index.php?title=Vehicle_Colors).
1129
+ */
1130
+ public pearlescentColor: number;
1131
+
1132
+ /**
1133
+ * Property used to gets/sets the vehicle's taxi lights state.
1134
+ */
1135
+ public taxiLights: boolean;
1136
+
1137
+ /**
1138
+ * Property used to gets/sets the vehicle's trim color.
1139
+ */
1140
+ public trimColor: number;
1141
+
1142
+ /**
1143
+ * Property used to gets/sets the vehicle's wheels [color](https://wiki.rage.mp/index.php?title=Vehicle_Colors).
1144
+ */
1145
+ public wheelColor: number;
1146
+
1147
+ /**
1148
+ * Property used to gets/sets the vehicle's wheel type.
1149
+ */
1150
+ public wheelType: number;
1151
+
1152
+ /**
1153
+ * Property used to gets/sets the vehicle's window tint.
1154
+ *
1155
+ * 1 - 255
1156
+ */
1157
+ public windowTint: number;
1158
+
1159
+ /**
1160
+ * Explodes the target vehicle.
1161
+ */
1162
+ public explode(): void;
1163
+
1164
+ /**
1165
+ * On the client-side, this function requires three args (red: int, green: int, blue: int), and will return an object: RGB
1166
+ *
1167
+ * @param id 0 - Primary Color | 1 - Secondary Color
1168
+ */
1169
+ public getColor(id: number): number;
1170
+
1171
+ /**
1172
+ * Used to get the vehicle RGB body color. Returns null if never set explicitly.
1173
+ *
1174
+ * @param id 0 - Primary Color | 1 - Secondary Color
1175
+ */
1176
+ public getColorRGB(id: number): RGB;
1177
+
1178
+ /**
1179
+ * Get the extra currently applied on vehicle in the target extra id.
1180
+ *
1181
+ * @param index - Extra Id
1182
+ */
1183
+ public getExtra(index: number): boolean;
1184
+
1185
+ /**
1186
+ * Gets the mod currently applied on your vehicle in the targetted modType.
1187
+ *
1188
+ * @param modType Mod Type
1189
+ */
1190
+ public getMod(modType: number): number;
1191
+
1192
+ /**
1193
+ * Used to get the current neon lights of a vehicle.
1194
+ */
1195
+ public getNeonColor(): number[];
1196
+
1197
+ /**
1198
+ * Get the occupant inside a vehicle by seat number
1199
+ *
1200
+ * @param seat Vehicle Seat
1201
+ */
1202
+ public getOccupant(seat: number): PlayerMp;
1203
+
1204
+ /**
1205
+ * Gets the occupants inside a vehicle.
1206
+ */
1207
+ public getOccupants(): PlayerMp[];
1208
+
1209
+ /**
1210
+ * Get vehicle paint by id
1211
+ *
1212
+ * @param id 0 - Primary Color | 1 - Secondary Color
1213
+ */
1214
+ public getPaint(id: number): number;
1215
+
1216
+ /**
1217
+ * Used for check, the vehicle is located in stream distance for player or not.
1218
+ *
1219
+ * @param player Player object
1220
+ */
1221
+ public isStreamed(player: PlayerMp): boolean;
1222
+
1223
+ /**
1224
+ * Repairs a vehicle.
1225
+ */
1226
+ public repair(): void;
1227
+
1228
+ /**
1229
+ * Sets vehicle body color. ([Vehicle colors](https://wiki.rage.mp/index.php?title=Vehicle_Colors))
1230
+ *
1231
+ * @param primary Primary Color
1232
+ * @param secondary Secondary Color
1233
+ */
1234
+ public setColor(primary: number, secondary: number): void;
1235
+
1236
+ /**
1237
+ * Sets vehicle RGB body color.
1238
+ *
1239
+ * @param red1 Primary Red Color [0 - 255]
1240
+ * @param green1 Primary Green Color [0 - 255]
1241
+ * @param blue1 Primary Blue Color [0 - 255]
1242
+ * @param red2 Secondary Red Color [0 - 255]
1243
+ * @param green2 Secondary Green Color [0 - 255]
1244
+ * @param blue2 Secondary Blue Color [0 - 255]
1245
+ */
1246
+ public setColorRGB(red1: number, green1: number, blue1: number, red2: number, green2: number, blue2: number): void;
1247
+
1248
+ /**
1249
+ * Max extra ID is 16.
1250
+ */
1251
+ public setExtra(index: number, value: boolean): void;
1252
+
1253
+ /**
1254
+ * Applies the specified mod onto the vehicle.
1255
+ *
1256
+ * @param modType Mod Type
1257
+ * @param modIndex Mod Index
1258
+ */
1259
+ public setMod(modType: number, modIndex: number): void;
1260
+
1261
+ /**
1262
+ * Sets vehicle neon lights.
1263
+ *
1264
+ * @param red Red Value 0 - 255.
1265
+ * @param green Green Value 0 - 255.
1266
+ * @param blue Blue Value 0 - 255.
1267
+ */
1268
+ public setNeonColor(red: number, green: number, blue: number): void;
1269
+
1270
+ /**
1271
+ * TODO: docs
1272
+ */
1273
+ public setPaint(primaryType: number, primaryColor: number, secondaryType: number, secondaryColor: number): void;
1274
+
1275
+ /**
1276
+ * TODO: docs
1277
+ */
1278
+ public setOccupant(seat: number, player: PlayerMp): void;
1279
+
1280
+ /**
1281
+ * Spawns vehicle.
1282
+ *
1283
+ * @param position Vector3
1284
+ * @param heading Heading
1285
+ */
1286
+ public spawn(position: Vector3, heading: number): void;
1287
+ }
1288
+
1289
+ declare interface VehicleMpPool extends EntityMpPool<VehicleMp> {
1290
+ 'new'(
1291
+ model: HashOrNumberOrString<RageEnums.Hashes.Vehicle>,
1292
+ position: Vector3,
1293
+ options?: {
1294
+ alpha?: number;
1295
+ color?: [Array2d, Array2d] | [RGB, RGB];
1296
+ dimension?: number;
1297
+ engine?: boolean;
1298
+ heading?: number;
1299
+ locked?: boolean;
1300
+ numberPlate?: string;
1301
+ }
1302
+ ): VehicleMp;
1303
+ }
1304
+
1305
+ declare interface EventMpThis {
1306
+ cancel: boolean;
1307
+ }
1308
+
1309
+ declare interface IServerEvents {
1310
+ entityCreated: (entity: EntityMp) => void;
1311
+ /*
1312
+ * @deprecated Broken/Removed in RageMP 1.1 DP1
1313
+ */
1314
+ entityDestroyed: (entity: EntityMp) => void;
1315
+ entityModelChange: (entity: EntityMp, oldModel: number) => void;
1316
+ incomingConnection: (ip: string, serial: string, rgscName: string, rgscId: string, gameType: string) => void;
1317
+ packagesLoaded: () => void;
1318
+ playerChat: (player: PlayerMp, text: string) => void;
1319
+ playerCommand: (player: PlayerMp, command: string) => void;
1320
+ playerDamage: (player: PlayerMp, healthLoss: number, armorLoss: number) => void;
1321
+ playerDeath: (player: PlayerMp, reason: number, killer?: PlayerMp) => void;
1322
+ playerEnterCheckpoint: (player: PlayerMp, checkpoint: CheckpointMp) => void;
1323
+ playerEnterColshape: (player: PlayerMp, colshape: ColshapeMp) => void;
1324
+ playerEnterVehicle: (player: PlayerMp, vehicle: VehicleMp, seat: RageEnums.VehicleSeat) => void;
1325
+ playerExitCheckpoint: (player: PlayerMp, checkpoint: CheckpointMp) => void;
1326
+ playerExitColshape: (player: PlayerMp, colshape: ColshapeMp) => void;
1327
+ playerExitVehicle: (player: PlayerMp, vehicle: VehicleMp, seat: number) => void;
1328
+ playerJoin: (player: PlayerMp) => void;
1329
+ playerQuit: (player: PlayerMp, exitType: string, reason: string) => void;
1330
+ playerReachWaypoint: (player: PlayerMp) => void;
1331
+ playerReady: (player: PlayerMp) => void;
1332
+ playerSpawn: (player: PlayerMp) => void;
1333
+ playerStartEnterVehicle: (player: PlayerMp, vehicle: VehicleMp, seat: RageEnums.VehicleSeat) => void;
1334
+ playerStartExitVehicle: (player: PlayerMp) => void;
1335
+ playerStreamIn: (player: PlayerMp, forPlayer: PlayerMp) => void;
1336
+ playerStreamOut: (player: PlayerMp, forPlayer: PlayerMp) => void;
1337
+ playerWeaponChange: (player: PlayerMp, oldWeapon: number, newWeapon: number) => void;
1338
+ serverShutdown: () => void;
1339
+ trailerAttached: (vehicle: VehicleMp, trailer: VehicleMp) => void;
1340
+ vehicleDamage: (vehicle: VehicleMp, bodyHealthLoss: number, engineHealthLoss: number) => void;
1341
+ vehicleDeath: (vehicle: VehicleMp) => void;
1342
+ vehicleHornToggle: (vehicle: VehicleMp, toggle: boolean) => void;
1343
+ vehicleSirenToggle: (vehicle: VehicleMp, toggle: boolean) => void;
1344
+ }
1345
+
1346
+ declare class EventMp {
1347
+ // @ts-ignore
1348
+ constructor<K extends keyof IServerEvents>(eventName: K, callback: IServerEvents[K]);
1349
+ constructor(eventName: string, callback: (...args: any[]) => void);
1350
+
1351
+ /**
1352
+ * Destroys the event
1353
+ */
1354
+ public destroy(): void;
1355
+ }
1356
+
1357
+ declare type MultiEventHandlers = Partial<IServerEvents> & Record<string, (...args: any) => void>;
1358
+
1359
+ declare type ThisifyServerEvents = {
1360
+ [P in keyof IServerEvents]: (this: EventMpThis, ...args: Parameters<IServerEvents[P]>) => void;
1361
+ }
1362
+
1363
+ declare class EventMpPool {
1364
+ /**
1365
+ * Delays server's shutdown till you finish all your async tasks.
1366
+ *
1367
+ * HINT: use [delayTermination](https://wiki.rage.mp/index.php?title=Events::delayTermination) instead.
1368
+ */
1369
+ public delayShutdown: boolean;
1370
+
1371
+ /**
1372
+ * Same as [delayShutdown](https://wiki.rage.mp/index.php?title=Events::delayTermination), but it seems to work over [delayShutdown](https://wiki.rage.mp/index.php?title=Events::delayTermination).
1373
+ */
1374
+ public delayTermination: boolean;
1375
+
1376
+ /**
1377
+ * Delays server's initialization of packages to run early functions.
1378
+ */
1379
+ public delayInitialization: boolean;
1380
+
1381
+ /**
1382
+ * Registers event handlers.
1383
+ *
1384
+ * Returning true will automatically destroy the event handler.
1385
+ *
1386
+ * @param eventName The name of the event you wish to attach a handler to
1387
+ * @param callback The function that you want the event to trigger, which has to be defined before you add the handler
1388
+ */
1389
+ public add<K extends keyof IServerEvents>(eventName: K, callback: ThisifyServerEvents[K]): void;
1390
+ public add(eventHandlers: MultiEventHandlers): void;
1391
+ public add(eventName: string, callback: (this: EventMpThis, ...args: any[]) => void): void;
1392
+
1393
+ /**
1394
+ * Registers a command handler.
1395
+ *
1396
+ * @param commandName The name of the command you wish to attach a handler to
1397
+ * @param callback The function that you want the command to trigger, which has to be defined before you add the handler
1398
+ */
1399
+ public addCommand(commandName: string, callback: (player: PlayerMp, fullText: string, ...args: string[]) => void): void;
1400
+ public addCommand(commands: { [commandName: string]: (player: PlayerMp, fullText: string, ...args: string[]) => void }): void;
1401
+
1402
+ /**
1403
+ * Register the specified player's Remote Procedure Call (RPC) event and expects a callback.
1404
+ *
1405
+ * @param procedureName The name of the procedure you wish to attach a handler to
1406
+ * @param callback The function that you want the RPC to trigger, which has to be defined before you add the handler
1407
+ */
1408
+ public addProc(procedureName: string, callback: (...args: any[]) => void): void;
1409
+ public addProc(procedures: { [name: string]: (...args: any[]) => void }): void;
1410
+
1411
+ /**
1412
+ * Calls registered event handlers. This function can call serverside events from serverside and clientside events from clientside.
1413
+ *
1414
+ * 1.1 - If you're sending number more than 2^31 to the client, you need to arg.toString() transform your number on server and parseInt(arg) on the client.
1415
+ *
1416
+ * @param eventName The name of the event you wish to call
1417
+ * @param args The arguments
1418
+ */
1419
+ public call<K extends keyof IServerEvents>(eventName: K, ...args: any[]): void;
1420
+ public call(eventName: string, ...args: any[]): void;
1421
+
1422
+ /**
1423
+ * Gets all handlers of the specified event.
1424
+ *
1425
+ * @param eventName Name of the event you want to get all handlers
1426
+ * @returns An array of specified event
1427
+ */
1428
+ public getAllOf<K extends keyof IServerEvents>(eventName: K): Function[];
1429
+ public getAllOf(eventName: string): Function[];
1430
+
1431
+ /**
1432
+ * Removes the specified event from events tree.
1433
+ *
1434
+ * @param eventName Name of the event you want to remove
1435
+ * @param callback The function that you want the event to remove
1436
+ */
1437
+ public remove<K extends keyof IServerEvents>(eventName: K, callback?: IServerEvents[K]): void;
1438
+ public remove(eventName: string, callback?: (...args: any[]) => void): void;
1439
+ public remove(eventNames: string[]): void;
1440
+
1441
+ /**
1442
+ * Returns a list of binded events.
1443
+ */
1444
+ readonly binded: { [key: string]: Function }[]
1445
+
1446
+ /**
1447
+ * Resets the whole event manager.
1448
+ */
1449
+ public reset(): void;
1450
+ }
1451
+
1452
+ declare class BlipMp extends EntityMp {
1453
+ /**
1454
+ * Property related to the Blip's color. [Colors](https://wiki.rage.mp/index.php?title=Blip::color)
1455
+ */
1456
+ color: number;
1457
+
1458
+ /**
1459
+ * Changes the name of the blip shown on the map. When you press Esc and hover over the blip, it will have this name.
1460
+ */
1461
+ name: string;
1462
+
1463
+ /**
1464
+ * Used to have a fade in/out of the blip when you're in range of the draw distance.
1465
+ */
1466
+ drawDistance: number;
1467
+
1468
+ /**
1469
+ * Changes the blip rotation.
1470
+ */
1471
+ rotation: number;
1472
+
1473
+ /**
1474
+ * Changes the blip scale.
1475
+ */
1476
+ scale: number;
1477
+
1478
+ /**
1479
+ * Changes the behavior of the Blip on the minimap.
1480
+ */
1481
+ shortRange: boolean;
1482
+
1483
+ /**
1484
+ * Changes the blip sprite. [Sprites](https://wiki.rage.mp/index.php?title=Blip::sprite)
1485
+ */
1486
+ sprite: number;
1487
+
1488
+ /**
1489
+ * Creates a route to the blip from the player's location.
1490
+ *
1491
+ * @param player Player object or an array of player objects
1492
+ * @param color All colors available on [Blip Colors](https://wiki.rage.mp/index.php?title=Blips#Blip_colors) page
1493
+ * @param scale Float
1494
+ */
1495
+ routeFor(player: PlayerMp | PlayerMp[] | undefined, color: number, scale: number): void;
1496
+
1497
+ /**
1498
+ * Removes a route to blip for player.
1499
+ *
1500
+ * @param player Array or object of player to which to remove route
1501
+ */
1502
+ unrouteFor(player: PlayerMp | PlayerMp[]): void;
1503
+ }
1504
+
1505
+ declare interface BlipMpPool extends EntityMpPool<BlipMp> {
1506
+ 'new'(
1507
+ sprite: number,
1508
+ position: Vector3,
1509
+ options?: {
1510
+ alpha?: number;
1511
+ color?: number;
1512
+ dimension?: number;
1513
+ drawDistance?: number;
1514
+ name?: string;
1515
+ rotation?: number;
1516
+ scale?: number;
1517
+ shortRange?: boolean;
1518
+ }
1519
+ ): BlipMp;
1520
+ }
1521
+
1522
+ declare class CheckpointMp extends EntityMp {
1523
+ /**
1524
+ * Property related to the Checkpoint's color.
1525
+ */
1526
+ color: number;
1527
+
1528
+ /**
1529
+ * This property is used to set or retrieve the direction of the checkpoint.
1530
+ */
1531
+ destination: Vector3;
1532
+
1533
+ /**
1534
+ * This property is used to set or get the radius of the checkpoint.
1535
+ */
1536
+ radius: number;
1537
+
1538
+ /**
1539
+ * This property is used to set or get the visible of the checkpoint.
1540
+ */
1541
+ visible: boolean;
1542
+
1543
+ /**
1544
+ * Returns an array of 4 numbers, with a checkpoint color.
1545
+ */
1546
+ getColor(): number[];
1547
+
1548
+ /**
1549
+ * Hiding a checkpoint for a particular player.
1550
+ */
1551
+ hideFor(player: PlayerMp): void;
1552
+
1553
+ /**
1554
+ * Sets the checkpoint color.
1555
+ *
1556
+ * @param red Red color value (0 to 255)
1557
+ * @param green Green color value (0 to 255)
1558
+ * @param blue Blue color value (0 to 255)
1559
+ * @param alpha Alpha color value (0 to 255)
1560
+ */
1561
+ setColor(red: number, green: number, blue: number, alpha: number): void;
1562
+
1563
+ /**
1564
+ * Showing a checkpoint for a particular player.
1565
+ */
1566
+ showFor(player: PlayerMp): void;
1567
+ }
1568
+
1569
+ declare interface CheckpointMpPool extends EntityMpPool<CheckpointMp> {
1570
+ 'new'(
1571
+ type: number,
1572
+ position: Vector3,
1573
+ radius: number,
1574
+ options?: {
1575
+ color?: RGBA;
1576
+ dimension?: number;
1577
+ direction?: Vector3;
1578
+ visible?: boolean;
1579
+ }
1580
+ ): CheckpointMp;
1581
+ }
1582
+
1583
+ declare class ColshapeMp extends EntityMp {
1584
+ /**
1585
+ * Returns type of colshape.
1586
+ */
1587
+ readonly shapeType: RageEnums.ColshapeType;
1588
+
1589
+ /**
1590
+ * Checking if a point is within the colshape.
1591
+ *
1592
+ * @param point Vector3
1593
+ */
1594
+ isPointWithin(point: Vector3): boolean;
1595
+ }
1596
+
1597
+ declare class ColshapeMpPool extends EntityMpPool<ColshapeMp> {
1598
+ /**
1599
+ * Create a ColShape of circle in the 2D plane
1600
+ *
1601
+ * @param x Number in float
1602
+ * @param y Number in float
1603
+ * @param range Number in float
1604
+ * @param dimension Number (optional parameter)
1605
+ */
1606
+ newCircle(x: number, y: number, range: number, dimension?: number): ColshapeMp;
1607
+
1608
+ /**
1609
+ * Creates a cuboid ColShape in 3D space
1610
+ *
1611
+ * @param x Number in float
1612
+ * @param y Number in float
1613
+ * @param z Number in float
1614
+ * @param width Number in float
1615
+ * @param depth Number in float
1616
+ * @param height Number in float
1617
+ * @param dimension Number (optional)
1618
+ */
1619
+ newCuboid(x: number, y: number, z: number, width: number, depth: number, height: number, dimension?: number): ColshapeMp;
1620
+
1621
+ /**
1622
+ * Creates a rectangle (square) ColShape 2D plane
1623
+ *
1624
+ * @param x Number in float
1625
+ * @param y Number in float
1626
+ * @param width Number in float
1627
+ * @param height Number in float
1628
+ * @param dimension Number (optional)
1629
+ */
1630
+ newRectangle(x: number, y: number, width: number, height: number, dimension?: number): ColshapeMp;
1631
+
1632
+ /**
1633
+ * Creates a Sphere ColShape
1634
+ *
1635
+ * @param x Number in float
1636
+ * @param y Number in float
1637
+ * @param z Number in float
1638
+ * @param range Number in float
1639
+ * @param dimension Number (optional parameter)
1640
+ */
1641
+ newSphere(x: number, y: number, z: number, range: number, dimension?: number): ColshapeMp;
1642
+
1643
+ /**
1644
+ * Creates a Colshape into the shape of a Tube.
1645
+ *
1646
+ * @param x Number in float
1647
+ * @param y Number in float
1648
+ * @param z Number in float
1649
+ * @param height Number in float
1650
+ * @param range Number in float
1651
+ * @param dimension Number in float
1652
+ */
1653
+ newTube(x: number, y: number, z: number, height: number, range: number, dimension?: number): ColshapeMp;
1654
+ }
1655
+
1656
+ declare class MarkerMp extends EntityMp {
1657
+ /**
1658
+ * TODO: docs
1659
+ */
1660
+ direction: Vector3;
1661
+
1662
+ /**
1663
+ * Sets the scale of the selected marker
1664
+ */
1665
+ scale: number;
1666
+
1667
+ /**
1668
+ * TODO: docs
1669
+ */
1670
+ visible: boolean;
1671
+
1672
+ /**
1673
+ * Gets the marker's color.
1674
+ */
1675
+ getColor(): number[];
1676
+
1677
+ /**
1678
+ * Hiding a marker for a particular player.
1679
+ */
1680
+ hideFor(player: PlayerMp): void;
1681
+
1682
+ /**
1683
+ * Sets the marker color.
1684
+ *
1685
+ * @param red Red color value (0 to 255)
1686
+ * @param green Green color value (0 to 255)
1687
+ * @param blue Blue color value (0 to 255)
1688
+ * @param alpha Alpha color value (0 to 255)
1689
+ */
1690
+ setColor(red: number, green: number, blue: number, alpha: number): void;
1691
+
1692
+ /**
1693
+ * Showing a marker for a particular player.
1694
+ */
1695
+ showFor(player: PlayerMp): void;
1696
+ }
1697
+
1698
+ declare interface MarkerMpPool extends EntityMpPool<MarkerMp> {
1699
+ 'new'(
1700
+ type: number,
1701
+ position: Vector3,
1702
+ scale: number,
1703
+ options?: {
1704
+ color?: RGBA;
1705
+ dimension?: number;
1706
+ direction?: Vector3;
1707
+ rotation?: Vector3;
1708
+ visible?: boolean;
1709
+ }
1710
+ ): MarkerMp;
1711
+ }
1712
+
1713
+ declare class TextLabelMp extends EntityMp {
1714
+ /**
1715
+ * Update the color of the selected label
1716
+ */
1717
+ color: RGB;
1718
+
1719
+ /**
1720
+ * Update the draw distance of the selected label
1721
+ */
1722
+ drawDistance: number;
1723
+
1724
+ /**
1725
+ * Updates the los(Line of Sight) on the selected label.
1726
+ */
1727
+ los: boolean;
1728
+
1729
+ /**
1730
+ * Updates the text of a created label.
1731
+ */
1732
+ text: string;
1733
+ }
1734
+
1735
+ declare interface TextLabelMpPool extends EntityMpPool<TextLabelMp> {
1736
+ 'new'(
1737
+ text: string,
1738
+ position: Vector3,
1739
+ options?: {
1740
+ color?: RGBA;
1741
+ dimension?: number;
1742
+ drawDistance?: number;
1743
+ font?: number;
1744
+ los?: boolean;
1745
+ }
1746
+ ): TextLabelMp;
1747
+ }
1748
+
1749
+ declare class PedMp extends EntityMp {
1750
+ controller: PlayerMp;
1751
+
1752
+ /**
1753
+ * Property used to gets/sets the ped's heading.
1754
+ */
1755
+ public heading: number;
1756
+ }
1757
+
1758
+ declare interface PedMpPool extends EntityMpPool<PedMp> {
1759
+ 'new'(
1760
+ modelHash: number,
1761
+ position: Vector3,
1762
+ options?: {
1763
+ dynamic?: boolean;
1764
+ frozen?: boolean;
1765
+ invincible?: boolean;
1766
+ lockController?: boolean;
1767
+ heading?: number;
1768
+ dimension?: number;
1769
+ }
1770
+ ): PedMp;
1771
+ }
1772
+
1773
+ declare class ObjectMp extends EntityMp {
1774
+ rotation: Vector3;
1775
+ }
1776
+
1777
+ declare interface ObjectMpPool extends EntityMpPool<ObjectMp> {
1778
+ /**
1779
+ * @see https://cdn.rage.mp/public/odb/index.html
1780
+ */
1781
+ 'new'(
1782
+ model: HashOrNumberOrString<string>,
1783
+ position: Vector3,
1784
+ options?: {
1785
+ alpha?: number;
1786
+ dimension?: number;
1787
+ rotation?: Vector3;
1788
+ }
1789
+ ): ObjectMp;
1790
+ }
1791
+
1792
+ declare interface WorldMp {
1793
+ /**
1794
+ * This property gets/sets game weather.
1795
+ *
1796
+ * [Weather](https://wiki.rage.mp/index.php?title=Weather)
1797
+ */
1798
+ weather: HashOrString<RageEnums.Weather>;
1799
+
1800
+ /**
1801
+ * This function sets time.
1802
+ */
1803
+ time: {
1804
+ hour: number;
1805
+ minute: number;
1806
+ second: number;
1807
+
1808
+ set(hour: number, minute: number, second: number): void;
1809
+ };
1810
+
1811
+ trafficLights: {
1812
+ /**
1813
+ * This property locks the traffic lights in their current position.
1814
+ */
1815
+ locked: boolean;
1816
+
1817
+ /**
1818
+ * This property set the traffic lights state.
1819
+ * (If you want to make your own traffic lights system,
1820
+ * make sure of locking the traffic lights to avoid the game to change them by itself.)
1821
+ */
1822
+ state: number;
1823
+ };
1824
+
1825
+ /**
1826
+ * Removes an IPL and sync it to every client
1827
+ *
1828
+ * @param ipl - [IPLs](https://wiki.rage.mp/index.php?title=Interiors_and_Locations)
1829
+ */
1830
+ removeIpl(ipl: string): void;
1831
+
1832
+ /**
1833
+ * Requests an IPL and sync it to every client.
1834
+ *
1835
+ * @param name ipl [IPLs](https://wiki.rage.mp/index.php?title=Interiors_and_Locations)
1836
+ */
1837
+ requestIpl(name: string): void;
1838
+
1839
+ /**
1840
+ * Starts a weather transition to the weather specified and sync it to all clients.
1841
+ *
1842
+ * @param weather - [Weather](https://wiki.rage.mp/index.php?title=Weather)
1843
+ * @param duration Weather transitioning time
1844
+ */
1845
+ setWeatherTransition(weather: HashOrString<RageEnums.Weather>, duration?: number): void;
1846
+ }
1847
+
1848
+ declare interface DummyMp {
1849
+ dummyType: number;
1850
+ }
1851
+
1852
+ declare interface DummyMpPool {
1853
+ 'new'(dummyEntityType: number, sharedVariables: KeyValueCollection): DummyMp;
1854
+
1855
+ forEachByType(dummyEntityType: number, fn: (entity: DummyMp) => void): void;
1856
+ }
1857
+
1858
+ declare interface ConfigMp {
1859
+ announce: boolean;
1860
+ bind: string;
1861
+ gamemode: string;
1862
+ encryption: boolean;
1863
+ maxplayers: number;
1864
+ name: string;
1865
+ 'stream-distance': number;
1866
+ port: number;
1867
+ 'disallow-multiple-connections-per-ip': boolean;
1868
+ 'limit-time-of-connections-per-ip': number;
1869
+ url: string;
1870
+ language: string;
1871
+ 'sync-rate': number;
1872
+ 'resource-scan-thread-limit': number;
1873
+ 'max-ping': number;
1874
+ 'min-fps': number;
1875
+ 'max-packet-loss': number;
1876
+ 'allow-cef-debugging': boolean;
1877
+ 'enable-nodejs': boolean;
1878
+ csharp: boolean;
1879
+ 'enable-http-security': boolean;
1880
+ 'voice-chat': boolean;
1881
+ 'allow-voice-chat-input': number;
1882
+ 'voice-chat-sample-rate': number;
1883
+ 'fastdl-host': string;
1884
+ 'create-fastdl-snapshot': boolean;
1885
+ }
1886
+
1887
+ declare interface NetworkMp {
1888
+ startBatch(): void;
1889
+ endBatch(): void;
1890
+ }
1891
+
1892
+ declare interface Mp {
1893
+ Player: typeof PlayerMp;
1894
+ players: PlayerMpPool;
1895
+
1896
+ Vehicle: typeof VehicleMp;
1897
+ vehicles: VehicleMpPool;
1898
+
1899
+ Event: typeof EventMp;
1900
+ events: EventMpPool;
1901
+
1902
+ Blip: typeof BlipMp;
1903
+ blips: BlipMpPool;
1904
+
1905
+ Checkpoint: typeof CheckpointMp;
1906
+ checkpoints: CheckpointMpPool;
1907
+
1908
+ Colshape: typeof ColshapeMp;
1909
+ colshapes: ColshapeMpPool;
1910
+
1911
+ Marker: typeof MarkerMp;
1912
+ markers: MarkerMpPool;
1913
+
1914
+ TextLabel: typeof TextLabelMp;
1915
+ labels: TextLabelMpPool;
1916
+
1917
+ Ped: typeof PedMp;
1918
+ peds: PedMpPool;
1919
+
1920
+ Object: typeof ObjectMp;
1921
+ objects: ObjectMpPool;
1922
+
1923
+ dummies: DummyMpPool;
1924
+ world: WorldMp;
1925
+ config: ConfigMp;
1926
+ network: NetworkMp;
1927
+
1928
+ Vector3: typeof Vector3;
1929
+
1930
+ joaat(str: string): number;
1931
+ joaat(strs: string[]): number[];
1932
+ }
1933
+
1934
+ declare const mp: Mp;