-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.go
2253 lines (1971 loc) · 89.3 KB
/
server.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package citizenfx
import "syscall/js"
type _server struct {
/**
* Adds a rectangular blip for the specified coordinates/area.
* It is recommended to use [SET_BLIP_ROTATION](#\_0xF87683CDF73C3F6E) and [SET_BLIP_COLOUR](#\_0x03D7FB09E75D6B7E) to make the blip not rotate along with the camera.
* By default, the blip will show as a *regular* blip with the specified color/sprite if it is outside of the minimap view.
* Example image:
* ![minimap](https://w.wew.wtf/pdcjig.png)
* ![big map](https://w.wew.wtf/zgcjcm.png)
* (Native name is *likely* to actually be ADD_BLIP_FOR_AREA, but due to the usual reasons this can't be confirmed)
* @param x The X coordinate of the center of the blip.
* @param y The Y coordinate of the center of the blip.
* @param z The Z coordinate of the center of the blip.
* @param width The width of the blip.
* @param height The height of the blip.
* @return A handle to the blip.
*/
AddBlipForArea func(x float64, y float64, z float64, width float64, height float64) float64 `js:"AddBlipForArea()"`
/**
* Creates a blip for the specified coordinates. You can use `SET_BLIP_` natives to change the blip.
* @param x The X coordinate to create the blip on.
* @param y The Y coordinate.
* @param z The Z coordinate.
* @return A blip handle.
*/
AddBlipForCoord func(x float64, y float64, z float64) float64 `js:"AddBlipForCoord()"`
/**
* Returns red ( default ) blip attached to entity.
* Example:
* Blip blip; //Put this outside your case or option
* blip = HUD::ADD_BLIP_FOR_ENTITY(YourPedOrBodyguardName);
* HUD::SET_BLIP_AS_FRIENDLY(blip, true);
*/
AddBlipForEntity func(entity float64) float64 `js:"AddBlipForEntity()"`
AddBlipForRadius func(posX float64, posY float64, posZ float64, radius float64) float64 `js:"AddBlipForRadius()"`
/**
* Applies an Item from a PedDecorationCollection to a ped. These include tattoos and shirt decals.
* collection - PedDecorationCollection filename hash
* overlay - Item name hash
* Example:
* Entry inside "mpbeach_overlays.xml" -
* <Item>
* <uvPos x="0.500000" y="0.500000" />
* <scale x="0.600000" y="0.500000" />
* <rotation value="0.000000" />
* <nameHash>FM_Hair_Fuzz</nameHash>
* <txdHash>mp_hair_fuzz</txdHash>
* <txtHash>mp_hair_fuzz</txtHash>
* <zone>ZONE_HEAD</zone>
* <type>TYPE_TATTOO</type>
* <faction>FM</faction>
* <garment>All</garment>
* <gender>GENDER_DONTCARE</gender>
* <award />
* <awardLevel />
* </Item>
* Code:
* PED::_0x5F5D1665E352A839(PLAYER::PLAYER_PED_ID(), MISC::GET_HASH_KEY("mpbeach_overlays"), MISC::GET_HASH_KEY("fm_hair_fuzz"))
*/
AddPedDecorationFromHashes func(ped float64, collection interface{}, overlay interface{}) `js:"AddPedDecorationFromHashes()"`
/**
* Adds a handler for changes to a state bag.
* The function called expects to match the following signature:
* ```ts
* function StateBagChangeHandler(bagName string, key string, value interface{} {
return 0.0 }, reserved float64, replicated bool);
* ```
* * **bagName**: The internal bag ID for the state bag which changed. This is usually `player:Source`, `entity:NetID`
* or `localEntity:Handle`.
* * **key**: The changed key.
* * **value**: The new value stored at key. The old value is still stored in the state bag at the time this callback executes.
* * **reserved**: Currently unused.
* * **replicated**: Whether the set is meant to be replicated.
* At this time, the change handler can't opt to reject changes.
* @param keyFilter The key to check for, or null.
* @param bagFilter The bag ID to check for, or null.
* @param handler The handler function.
* @return A cookie to remove the change handler.
*/
AddStateBagChangeHandler func(keyFilter string, bagFilter string, handler js.Func) float64 `js:"AddStateBagChangeHandler()"`
/**
* Applies a force to the specified entity.
* **List of force types (p1)**:
* ```
* public enum ForceType
* {
* MinForce = 0,
* MaxForceRot = 1,
* MinForce2 = 2,
* MaxForceRot2 = 3,
* ForceNoRot = 4,
* ForceRotPlusForce = 5
* }
* ```
* Research/documentation on the gtaforums can be found [here](https://gtaforums.com/topic/885669-precisely-define-object-physics/) and [here](https://gtaforums.com/topic/887362-apply-forces-and-momentums-to-entityobject/).
* @param entity The entity you want to apply a force on
* @param forceType See native description above for a list of commonly used values
* @param x Force amount (X)
* @param y Force amount (Y)
* @param z Force amount (Z)
* @param offX Rotation/offset force (X)
* @param offY Rotation/offset force (Y)
* @param offZ Rotation/offset force (Z)
* @param boneIndex (Often 0) Entity bone index
* @param isDirectionRel (Usually false) Vector defined in local (body-fixed) coordinate frame
* @param ignoreUpVec (Usually true)
* @param isForceRel (Usually true) When true, force gets multiplied with the objects mass and different objects will have the same acceleration
* @param p12 (Usually false)
* @param p13 (Usually true)
*/
ApplyForceToEntity func(entity float64, forceType float64, x float64, y float64, z float64, offX float64, offY float64, offZ float64, boneIndex float64, isDirectionRel bool, ignoreUpVec bool, isForceRel bool, p12 bool, p13 bool) `js:"ApplyForceToEntity()"`
/**
* Returns whether or not the specified player has enough information to start a commerce session for.
* @param playerSrc The player handle
* @return True or false.
*/
CanPlayerStartCommerceSession func(playerSrc string) bool `js:"CanPlayerStartCommerceSession()"`
/**
* Cancels the currently executing event.
*/
CancelEvent func() `js:"CancelEvent()"`
/**
* List of component/props ID
* gtaxscripting.blogspot.com/2016/04/gta-v-peds-component-and-props.html
*/
ClearPedProp func(ped float64, propId float64) `js:"ClearPedProp()"`
ClearPedSecondaryTask func(ped float64) `js:"ClearPedSecondaryTask()"`
ClearPedTasks func(ped float64) `js:"ClearPedTasks()"`
/**
* Immediately stops the pedestrian from whatever it's doing. They stop fighting, animations, etc. they forget what they were doing.
*/
ClearPedTasksImmediately func(ped float64) `js:"ClearPedTasksImmediately()"`
/**
* This executes at the same as speed as PLAYER::SET_PLAYER_WANTED_LEVEL(player, 0, false);
* PLAYER::GET_PLAYER_WANTED_LEVEL(player); executes in less than half the time. Which means that it's worth first checking if the wanted level needs to be cleared before clearing. However, this is mostly about good code practice and can important in other situations. The difference in time in this example is negligible.
*/
ClearPlayerWantedLevel func(player string) `js:"ClearPlayerWantedLevel()"`
/**
* Creates an object (prop) with the specified model at the specified position, offset on the Z axis by the radius of the object's model.
* This object will initially be owned by the creating script as a mission entity, and the model should be loaded already (e.g. using REQUEST_MODEL).
* @param modelHash The model to spawn.
* @param x Spawn coordinate X component.
* @param y Spawn coordinate Y component.
* @param z Spawn coordinate Z component, 'ground level'.
* @param isNetwork Whether to create a network object for the object. If false, the object exists only locally.
* @param netMissionEntity Whether to register the object as pinned to the script host in the R\* network model.
* @param doorFlag False to create a door archetype (archetype flag bit 26 set) as a door. Required to be set to true to create door models in network mode.
* @return A script handle (fwScriptGuid index) for the object, or `0` if the object failed to be created.
*/
CreateObject func(modelHash interface{}, x float64, y float64, z float64, isNetwork bool, netMissionEntity bool, doorFlag bool) float64 `js:"CreateObject()"`
/**
* Creates an object (prop) with the specified model centered at the specified position.
* This object will initially be owned by the creating script as a mission entity, and the model should be loaded already (e.g. using REQUEST_MODEL).
* @param modelHash The model to spawn.
* @param x Spawn coordinate X component.
* @param y Spawn coordinate Y component.
* @param z Spawn coordinate Z component.
* @param isNetwork Whether to create a network object for the object. If false, the object exists only locally.
* @param netMissionEntity Whether to register the object as pinned to the script host in the R\* network model.
* @param doorFlag False to create a door archetype (archetype flag bit 26 set) as a door. Required to be set to true to create door models in network mode.
* @return A script handle (fwScriptGuid index) for the object, or `0` if the object failed to be created.
*/
CreateObjectNoOffset func(modelHash interface{}, x float64, y float64, z float64, isNetwork bool, netMissionEntity bool, doorFlag bool) float64 `js:"CreateObjectNoOffset()"`
/**
* Creates a ped (biped character, pedestrian, actor) with the specified model at the specified position and heading.
* This ped will initially be owned by the creating script as a mission entity, and the model should be loaded already
* (e.g. using REQUEST_MODEL).
* @param pedType Unused. Peds get set to CIVMALE/CIVFEMALE/etc. no matter the value specified.
* @param modelHash The model of ped to spawn.
* @param x Spawn coordinate X component.
* @param y Spawn coordinate Y component.
* @param z Spawn coordinate Z component.
* @param heading Heading to face towards, in degrees.
* @param isNetwork Whether to create a network object for the ped. If false, the ped exists only locally.
* @param bScriptHostPed Whether to register the ped as pinned to the script host in the R\* network model.
* @return A script handle (fwScriptGuid index) for the ped, or `0` if the ped failed to be created.
*/
CreatePed func(pedType float64, modelHash interface{}, x float64, y float64, z float64, heading float64, isNetwork bool, bScriptHostPed bool) float64 `js:"CreatePed()"`
CreatePedInsideVehicle func(vehicle float64, pedType float64, modelHash interface{}, seat float64, isNetwork bool, bScriptHostPed bool) float64 `js:"CreatePedInsideVehicle()"`
/**
* Creates a vehicle with the specified model at the specified position. This vehicle will initially be owned by the creating
* script as a mission entity, and the model should be loaded already (e.g. using REQUEST_MODEL).
* ```
* NativeDB Added Parameter 8: BOOL p7
* ```
* @param modelHash The model of vehicle to spawn.
* @param x Spawn coordinate X component.
* @param y Spawn coordinate Y component.
* @param z Spawn coordinate Z component.
* @param heading Heading to face towards, in degrees.
* @param isNetwork Whether to create a network object for the vehicle. If false, the vehicle exists only locally.
* @param netMissionEntity Whether to register the vehicle as pinned to the script host in the R\* network model.
* @return A script handle (fwScriptGuid index) for the vehicle, or `0` if the vehicle failed to be created.
*/
CreateVehicle func(modelHash interface{}, x float64, y float64, z float64, heading float64, isNetwork bool, netMissionEntity bool) float64 `js:"CreateVehicle()"`
/**
* Deletes the specified entity.
* @param entity The entity to delete.
*/
DeleteEntity func(entity float64) `js:"DeleteEntity()"`
DeleteFunctionReference func(referenceIdentity string) `js:"DeleteFunctionReference()"`
DeleteResourceKvp func(key string) `js:"DeleteResourceKvp()"`
/**
* Nonsynchronous [DELETE_RESOURCE_KVP](#\_0x7389B5DF) operation; see [FLUSH_RESOURCE_KVP](#\_0x5240DA5A).
* @param key The key to delete
*/
DeleteResourceKvpNoSync func(key string) `js:"DeleteResourceKvpNoSync()"`
DoesEntityExist func(entity float64) bool `js:"DoesEntityExist()"`
/**
* Requests whether or not the player owns the specified SKU.
* @param playerSrc The player handle
* @param skuId The ID of the SKU.
* @return A boolean.
*/
DoesPlayerOwnSku func(playerSrc string, skuId float64) bool `js:"DoesPlayerOwnSku()"`
/**
* Requests whether or not the player owns the specified package.
* @param playerSrc The player handle
* @param skuId The package ID on Tebex.
* @return A boolean.
*/
DoesPlayerOwnSkuExt func(playerSrc string, skuId float64) bool `js:"DoesPlayerOwnSkuExt()"`
DropPlayer func(playerSrc string, reason string) `js:"DropPlayer()"`
DuplicateFunctionReference func(referenceIdentity string) string `js:"DuplicateFunctionReference()"`
EnableEnhancedHostSupport func(enabled bool) `js:"EnableEnhancedHostSupport()"`
EndFindKvp func(handle float64) `js:"EndFindKvp()"`
/**
* Internal function for ensuring an entity has a state bag.
*/
EnsureEntityStateBag func(entity float64) `js:"EnsureEntityStateBag()"`
ExecuteCommand func(commandString string) `js:"ExecuteCommand()"`
FindKvp func(handle float64) string `js:"FindKvp()"`
FlagServerAsPrivate func(private_ bool) `js:"FlagServerAsPrivate()"`
/**
* Nonsynchronous operations will not wait for a disk/filesystem flush before returning from a write or delete call. They will be much faster than their synchronous counterparts (e.g., bulk operations), however, a system crash may lose the data to some recent operations.
* This native ensures all `_NO_SYNC` operations are synchronized with the disk/filesystem.
*/
FlushResourceKvp func() `js:"FlushResourceKvp()"`
/**
* Freezes or unfreezes an entity preventing its coordinates to change by the player if set to `true`. You can still change the entity position using SET_ENTITY_COORDS.
* @param entity The entity to freeze/unfreeze.
* @param toggle Freeze or unfreeze entity.
*/
FreezeEntityPosition func(entity float64, toggle bool) `js:"FreezeEntityPosition()"`
GetAirDragMultiplierForPlayersVehicle func(playerSrc string) float64 `js:"GetAirDragMultiplierForPlayersVehicle()"`
/**
* Returns all object handles known to the server.
* The data returned adheres to the following layout:
* ```
* [127, 42, 13, 37]
* ```
* @return An object containing a list of object handles.
*/
GetAllObjects func() js.Value `js:"GetAllObjects()"`
/**
* Returns all peds handles known to the server.
* The data returned adheres to the following layout:
* ```
* [127, 42, 13, 37]
* ```
* @return An object containing a list of peds handles.
*/
GetAllPeds func() js.Value `js:"GetAllPeds()"`
/**
* Returns all vehicle handles known to the server.
* The data returned adheres to the following layout:
* ```
* [127, 42, 13, 37]
* ```
* @return An object containing a list of vehicle handles.
*/
GetAllVehicles func() js.Value `js:"GetAllVehicles()"`
GetBlipSprite func(self float64) float64 `js:"GetBlipSprite()"`
/**
* Returns the current console output buffer.
* @return The most recent game console output, as a string.
*/
GetConsoleBuffer func() string `js:"GetConsoleBuffer()"`
GetConvar func(varName string, default_ string) string `js:"GetConvar()"`
GetConvarInt func(varName string, default_ float64) float64 `js:"GetConvarInt()"`
/**
* Returns the name of the currently executing resource.
* @return The name of the resource.
*/
GetCurrentResourceName func() js.Value `js:"GetCurrentResourceName()"`
/**
* Gets the current coordinates for a specified entity. This native is used server side when using OneSync.
* See [GET_ENTITY_COORDS](#\_0x3FEF770D40960D5A) for client side.
* @param entity The entity to get the coordinates from.
* @return The current entity coordinates.
*/
GetEntityCoords func(entity float64) js.Value `js:"GetEntityCoords()"`
GetEntityHeading func(entity float64) float64 `js:"GetEntityHeading()"`
/**
* Currently it only works with peds.
*/
GetEntityHealth func(entity float64) float64 `js:"GetEntityHealth()"`
/**
* Currently it only works with peds.
*/
GetEntityMaxHealth func(entity float64) float64 `js:"GetEntityMaxHealth()"`
GetEntityModel func(entity float64) float64 `js:"GetEntityModel()"`
/**
* This native gets an entity's population type.
* @param entity the entity to obtain the population type from
* @return Returns the population type ID, defined by the below enumeration:```cpp
enum ePopulationType
{
POPTYPE_UNKNOWN = 0,
POPTYPE_RANDOM_PERMANENT,
POPTYPE_RANDOM_PARKED,
POPTYPE_RANDOM_PATROL,
POPTYPE_RANDOM_SCENARIO,
POPTYPE_RANDOM_AMBIENT,
POPTYPE_PERMANENT,
POPTYPE_MISSION,
POPTYPE_REPLAY,
POPTYPE_CACHE,
POPTYPE_TOOL
};
```
*/
GetEntityPopulationType func(entity float64) float64 `js:"GetEntityPopulationType()"`
GetEntityRotation func(entity float64) js.Value `js:"GetEntityRotation()"`
GetEntityRotationVelocity func(entity float64) js.Value `js:"GetEntityRotationVelocity()"`
/**
* Gets the routing bucket for the specified entity.
* Routing buckets are also known as 'dimensions' or 'virtual worlds' in past echoes, however they are population-aware.
* @param entity The entity to get the routing bucket for.
* @return The routing bucket ID.
*/
GetEntityRoutingBucket func(entity float64) float64 `js:"GetEntityRoutingBucket()"`
GetEntityScript func(entity float64) string `js:"GetEntityScript()"`
/**
* Gets the current speed of the entity in meters per second.
* ```
* To convert to MPH: speed * 2.236936
* To convert to KPH: speed * 3.6
* ```
* @param entity The entity to get the speed of
* @return The speed of the entity in meters per second
*/
GetEntitySpeed func(entity float64) float64 `js:"GetEntitySpeed()"`
GetEntityType func(entity float64) float64 `js:"GetEntityType()"`
GetEntityVelocity func(entity float64) js.Value `js:"GetEntityVelocity()"`
/**
* Returns the internal build number of the current game being executed.
* Possible values:
* * FiveM
* * 1604
* * 2060
* * 2189
* * 2372
* * RedM
* * 1311
* * 1355
* * 1436
* * LibertyM
* * 43
* * FXServer
* * 0
* @return The build number, or **0** if no build number is known.
*/
GetGameBuildNumber func() float64 `js:"GetGameBuildNumber()"`
/**
* Returns the current game being executed.
* Possible values:
* | Return value | Meaning |
* | ------------ | ------------------------------ |
* | `fxserver` | Server-side code ('Duplicity') |
* | `fivem` | FiveM for GTA V |
* | `libertym` | LibertyM for GTA IV |
* | `redm` | RedM for Red Dead Redemption 2 |
* @return The game the script environment is running in.
*/
GetGameName func() string `js:"GetGameName()"`
/**
* Gets the current game timer in milliseconds.
* @return The game time.
*/
GetGameTimer func() float64 `js:"GetGameTimer()"`
/**
* This native converts the passed string to a hash.
*/
GetHashKey func(model string) float64 `js:"GetHashKey()"`
GetHostId func() string `js:"GetHostId()"`
GetInstanceId func() float64 `js:"GetInstanceId()"`
GetInvokingResource func() string `js:"GetInvokingResource()"`
GetIsVehicleEngineRunning func(vehicle float64) bool `js:"GetIsVehicleEngineRunning()"`
GetIsVehiclePrimaryColourCustom func(vehicle float64) bool `js:"GetIsVehiclePrimaryColourCustom()"`
GetIsVehicleSecondaryColourCustom func(vehicle float64) bool `js:"GetIsVehicleSecondaryColourCustom()"`
/**
* See the client-side [GET_LANDING_GEAR_STATE](#\_0x9B0F3DCA3DB0F4CD) native for a description of landing gear states.
* @param vehicle The vehicle to check.
* @return The current state of the vehicles landing gear.
*/
GetLandingGearState func(vehicle float64) float64 `js:"GetLandingGearState()"`
/**
* Seat indexes:
* * 1 = Driver
* * 2 = Front Right Passenger
* * 3 = Back Left Passenger
* * 4 = Back Right Passenger
* * 5 = Further Back Left Passenger (vehicles > 4 seats)
* * 6 = Further Back Right Passenger (vehicles > 4 seats)
* * etc.
* @param vehicle The target vehicle.
* @param index The seat index.
* @return The last ped in the specified seat of the passed vehicle. Returns 0 if the specified seat was never occupied or the last ped does not exist anymore.
*/
GetLastPedInVehicleSeat func(vehicle float64, index float64) float64 `js:"GetLastPedInVehicleSeat()"`
GetNumPlayerIdentifiers func(playerSrc string) float64 `js:"GetNumPlayerIdentifiers()"`
GetNumPlayerIndices func() float64 `js:"GetNumPlayerIndices()"`
GetNumPlayerTokens func(playerSrc string) float64 `js:"GetNumPlayerTokens()"`
/**
* Gets the amount of metadata values with the specified key existing in the specified resource's manifest.
* See also: [Resource manifest](https://docs.fivem.net/resources/manifest/)
* @param resourceName The resource name.
* @param metadataKey The key to look up in the resource manifest.
*/
GetNumResourceMetadata func(resourceName string, metadataKey string) float64 `js:"GetNumResourceMetadata()"`
GetNumResources func() float64 `js:"GetNumResources()"`
GetPasswordHash func(password string) string `js:"GetPasswordHash()"`
GetPedArmour func(ped float64) float64 `js:"GetPedArmour()"`
GetPedCauseOfDeath func(ped float64) float64 `js:"GetPedCauseOfDeath()"`
GetPedDesiredHeading func(ped float64) float64 `js:"GetPedDesiredHeading()"`
/**
* Seat indexes:
* * 1 = Driver
* * 2 = Front Right Passenger
* * 3 = Back Left Passenger
* * 4 = Back Right Passenger
* * 5 = Further Back Left Passenger (vehicles > 4 seats)
* * 6 = Further Back Right Passenger (vehicles > 4 seats)
* * etc.
* @param vehicle The target vehicle.
* @param index The seat index.
* @return The ped in the specified seat of the passed vehicle. Returns 0 if the specified seat is not occupied.
*/
GetPedInVehicleSeat func(vehicle float64, index float64) float64 `js:"GetPedInVehicleSeat()"`
GetPedMaxHealth func(ped float64) float64 `js:"GetPedMaxHealth()"`
/**
* Gets the script task command currently assigned to the ped.
* @param ped The target ped.
* @return The script task command currently assigned to the ped. A value of 0x811E343C denotes no script task is assigned.
*/
GetPedScriptTaskCommand func(ped float64) float64 `js:"GetPedScriptTaskCommand()"`
/**
* Gets the stage of the peds scripted task.
* @param ped The target ped.
* @return The stage of the ped's scripted task. A value of 3 denotes no script task is assigned.
*/
GetPedScriptTaskStage func(ped float64) float64 `js:"GetPedScriptTaskStage()"`
/**
* Get the last entity that damaged the ped. This native is used server side when using OneSync.
* @param ped The target ped
* @return The entity id. Returns 0 if the ped has not been damaged recently.
*/
GetPedSourceOfDamage func(ped float64) float64 `js:"GetPedSourceOfDamage()"`
/**
* Get the entity that killed the ped. This native is used server side when using OneSync.
* @param ped The target ped
* @return The entity id. Returns 0 if the ped has no killer.
*/
GetPedSourceOfDeath func(ped float64) float64 `js:"GetPedSourceOfDeath()"`
/**
* Gets the type of a ped's specific task given an index of the CPedTaskSpecificDataNode nodes.
* A ped will typically have a task at index 0, if a ped has multiple tasks at once they will be in the order 0, 1, 2, etc.
* @param ped The target ped.
* @param index A zero-based index with a maximum value of 7.
* @return The type of the specific task.
1604: A value of 530 denotes no script task is assigned or an invalid input was given.
2060+: A value of 531 denotes no script task is assigned or an invalid input was given.
*/
GetPedSpecificTaskType func(ped float64, index float64) float64 `js:"GetPedSpecificTaskType()"`
/**
* Gets the current camera rotation for a specified player. This native is used server side when using OneSync.
* @param playerSrc The player handle.
* @return The player's camera rotation. Values are in radians.
*/
GetPlayerCameraRotation func(playerSrc string) js.Value `js:"GetPlayerCameraRotation()"`
GetPlayerEndpoint func(playerSrc string) string `js:"GetPlayerEndpoint()"`
/**
* Gets the current fake wanted level for a specified player. This native is used server side when using OneSync.
* @param playerSrc The target player
* @return The fake wanted level
*/
GetPlayerFakeWantedLevel func(playerSrc string) float64 `js:"GetPlayerFakeWantedLevel()"`
GetPlayerFromIndex func(index float64) string `js:"GetPlayerFromIndex()"`
GetPlayerGuid func(playerSrc string) string `js:"GetPlayerGuid()"`
GetPlayerIdentifier func(playerSrc string, identifier float64) string `js:"GetPlayerIdentifier()"`
GetPlayerInvincible func(playerSrc string) bool `js:"GetPlayerInvincible()"`
GetPlayerLastMsg func(playerSrc string) float64 `js:"GetPlayerLastMsg()"`
GetPlayerMaxArmour func(playerSrc string) float64 `js:"GetPlayerMaxArmour()"`
GetPlayerMaxHealth func(playerSrc string) float64 `js:"GetPlayerMaxHealth()"`
/**
* A getter for [SET_PLAYER_MELEE_WEAPON_DAMAGE_MODIFIER](#\_0x4A3DC7ECCC321032).
* @param playerId The player index.
* @return Returns player melee weapon damage modifier value.
*/
GetPlayerMeleeWeaponDamageModifier func(playerId string) float64 `js:"GetPlayerMeleeWeaponDamageModifier()"`
GetPlayerName func(playerSrc string) string `js:"GetPlayerName()"`
GetPlayerPed func(playerSrc string) float64 `js:"GetPlayerPed()"`
GetPlayerPing func(playerSrc string) float64 `js:"GetPlayerPing()"`
/**
* Gets the routing bucket for the specified player.
* Routing buckets are also known as 'dimensions' or 'virtual worlds' in past echoes, however they are population-aware.
* @param playerSrc The player to get the routing bucket for.
* @return The routing bucket ID.
*/
GetPlayerRoutingBucket func(playerSrc string) float64 `js:"GetPlayerRoutingBucket()"`
GetPlayerTeam func(playerSrc string) float64 `js:"GetPlayerTeam()"`
/**
* Gets the amount of time player has spent evading the cops.
* Counter starts and increments only when cops are chasing the player.
* If the player is evading, the timer will pause.
* @param playerSrc The target player
* @param lastPursuit False = CurrentPursuit, True = LastPursuit
* @return Returns -1, if the player is not wanted or wasn't in pursuit before, depending on the lastPursuit parameter
Returns 0, if lastPursuit == False and the player has a wanted level, but the pursuit has not started yet
Otherwise, will return the milliseconds of the pursuit.
*/
GetPlayerTimeInPursuit func(playerSrc string, lastPursuit bool) float64 `js:"GetPlayerTimeInPursuit()"`
/**
* Gets a player's token. Tokens can be used to enhance banning logic, however are specific to a server.
* @param playerSrc A player.
* @param index Index between 0 and GET_NUM_PLAYER_TOKENS.
* @return A token value.
*/
GetPlayerToken func(playerSrc string, index float64) string `js:"GetPlayerToken()"`
/**
* Gets the current known coordinates for the specified player from cops perspective. This native is used server side when using OneSync.
* @param playerSrc The target player
* @return The player's position known by police. Vector zero if the player has no wanted level.
*/
GetPlayerWantedCentrePosition func(playerSrc string) js.Value `js:"GetPlayerWantedCentrePosition()"`
/**
* Returns given players wanted level server-side.
* @param playerSrc The target player
* @return The wanted level
*/
GetPlayerWantedLevel func(playerSrc string) float64 `js:"GetPlayerWantedLevel()"`
/**
* A getter for [SET_PLAYER_WEAPON_DAMAGE_MODIFIER](#\_0xCE07B9F7817AADA3).
* @param playerId The player index.
* @return The value of player weapon damage modifier.
*/
GetPlayerWeaponDamageModifier func(playerId string) float64 `js:"GetPlayerWeaponDamageModifier()"`
/**
* A getter for [SET_PLAYER_WEAPON_DEFENSE_MODIFIER](#\_0x2D83BC011CA14A3C).
* @param playerId The player index.
* @return The value of player weapon defense modifier.
*/
GetPlayerWeaponDefenseModifier func(playerId string) float64 `js:"GetPlayerWeaponDefenseModifier()"`
/**
* A getter for [\_SET_PLAYER_WEAPON_DEFENSE_MODIFIER\_2](#\_0xBCFDE9EDE4CF27DC).
* @param playerId The player index.
* @return The value of player weapon defense modifier 2.
*/
GetPlayerWeaponDefenseModifier_2 func(playerId string) float64 `js:"GetPlayerWeaponDefenseModifier_2()"`
/**
* Returns all commands that are registered in the command system.
* The data returned adheres to the following layout:
* ```
* [
* {
* "name": "cmdlist"
* },
* {
* "name": "command1"
* }
* ]
* ```
* @return An object containing registered commands.
*/
GetRegisteredCommands func() js.Value `js:"GetRegisteredCommands()"`
GetResourceByFindIndex func(findIndex float64) string `js:"GetResourceByFindIndex()"`
/**
* A getter for [SET_RESOURCE_KVP_FLOAT](#\_0x9ADD2938).
* @param key The key to fetch
* @return A float that contains the value stored in the Kvp or nil/null if none.
*/
GetResourceKvpFloat func(key string) float64 `js:"GetResourceKvpFloat()"`
/**
* A getter for [SET_RESOURCE_KVP_INT](#\_0x6A2B1E8).
* @param key The key to fetch
* @return A int that contains the value stored in the Kvp or nil/null if none.
*/
GetResourceKvpInt func(key string) float64 `js:"GetResourceKvpInt()"`
/**
* A getter for [SET_RESOURCE_KVP](#\_0x21C7A35B).
* @param key The key to fetch
* @return A string that contains the value stored in the Kvp or nil/null if none.
*/
GetResourceKvpString func(key string) string `js:"GetResourceKvpString()"`
/**
* Gets the metadata value at a specified key/index from a resource's manifest.
* See also: [Resource manifest](https://docs.fivem.net/resources/manifest/)
* @param resourceName The resource name.
* @param metadataKey The key in the resource manifest.
* @param index The value index, in a range from \[0..GET_NUM_RESOURCE_METDATA-1].
*/
GetResourceMetadata func(resourceName string, metadataKey string, index float64) string `js:"GetResourceMetadata()"`
/**
* Returns the physical on-disk path of the specified resource.
* @param resourceName The name of the resource.
* @return The resource directory name, possibly without trailing slash.
*/
GetResourcePath func(resourceName string) string `js:"GetResourcePath()"`
/**
* Returns the current state of the specified resource.
* @param resourceName The name of the resource.
* @return The resource state. One of `"missing", "started", "starting", "stopped", "stopping", "uninitialized" or "unknown"`.
*/
GetResourceState func(resourceName string) string `js:"GetResourceState()"`
/**
* Returns a hash of selected ped weapon.
* @param ped The target ped.
* @return The weapon hash.
*/
GetSelectedPedWeapon func(ped float64) float64 `js:"GetSelectedPedWeapon()"`
/**
* Returns the value of a state bag key.
* @return Value.
*/
GetStateBagValue func(bagName string, key string) js.Value `js:"GetStateBagValue()"`
GetTrainCarriageEngine func(train float64) float64 `js:"GetTrainCarriageEngine()"`
GetTrainCarriageIndex func(train float64) float64 `js:"GetTrainCarriageIndex()"`
GetVehicleBodyHealth func(vehicle float64) float64 `js:"GetVehicleBodyHealth()"`
GetVehicleColours func(vehicle float64) (float64, float64) `js:"GetVehicleColours()"`
GetVehicleCustomPrimaryColour func(vehicle float64) (float64, float64, float64) `js:"GetVehicleCustomPrimaryColour()"`
GetVehicleCustomSecondaryColour func(vehicle float64) (float64, float64, float64) `js:"GetVehicleCustomSecondaryColour()"`
GetVehicleDashboardColour func(vehicle float64, color float64) float64 `js:"GetVehicleDashboardColour()"`
GetVehicleDirtLevel func(vehicle float64) float64 `js:"GetVehicleDirtLevel()"`
/**
* enum VehicleLockStatus = {
* None = 0,
* Unlocked = 1,
* Locked = 2,
* LockedForPlayer = 3,
* StickPlayerInside = 4, -- Doesn't allow players to exit the vehicle with the exit vehicle key.
* CanBeBrokenInto = 7, -- Can be broken into the car. If the glass is broken, the value will be set to 1
* CanBeBrokenIntoPersist = 8, -- Can be broken into persist
* CannotBeTriedToEnter = 10, -- Cannot be tried to enter (Nothing happens when you press the vehicle enter key).
* }
*/
GetVehicleDoorLockStatus func(vehicle float64) float64 `js:"GetVehicleDoorLockStatus()"`
GetVehicleDoorStatus func(vehicle float64) float64 `js:"GetVehicleDoorStatus()"`
/**
* Currently it only works when set to "all players".
*/
GetVehicleDoorsLockedForPlayer func(vehicle float64) float64 `js:"GetVehicleDoorsLockedForPlayer()"`
GetVehicleEngineHealth func(vehicle float64) float64 `js:"GetVehicleEngineHealth()"`
GetVehicleExtraColours func(vehicle float64) (float64, float64) `js:"GetVehicleExtraColours()"`
/**
* Gets the flight nozzel position for the specified vehicle. See the client-side [\_GET_VEHICLE_FLIGHT_NOZZLE_POSITION](#\_0xDA62027C8BDB326E) native for usage examples.
* @param vehicle The vehicle to check.
* @return The flight nozzel position between 0.0 (flying normally) and 1.0 (VTOL mode)
*/
GetVehicleFlightNozzlePosition func(vehicle float64) float64 `js:"GetVehicleFlightNozzlePosition()"`
GetVehicleHandbrake func(vehicle float64) bool `js:"GetVehicleHandbrake()"`
GetVehicleHeadlightsColour func(vehicle float64) float64 `js:"GetVehicleHeadlightsColour()"`
/**
* Gets the lock on state for the specified vehicle. See the client-side [GET_VEHICLE_HOMING_LOCKON_STATE](#\_0xE6B0E8CFC3633BF0) native for a description of lock on states.
* @param vehicle The vehicle to check.
* @return The lock on state.
*/
GetVehicleHomingLockonState func(vehicle float64) float64 `js:"GetVehicleHomingLockonState()"`
GetVehicleInteriorColour func(vehicle float64, color float64) float64 `js:"GetVehicleInteriorColour()"`
GetVehicleLightsState func(vehicle float64) (bool, interface{}, interface{}) `js:"GetVehicleLightsState()"`
GetVehicleLivery func(vehicle float64) float64 `js:"GetVehicleLivery()"`
/**
* Gets the vehicle that is locked on to for the specified vehicle.
* @param vehicle The vehicle to check.
* @return The vehicle that is locked on. 0 returned if no vehicle is locked on.
*/
GetVehicleLockOnTarget func(vehicle float64) float64 `js:"GetVehicleLockOnTarget()"`
GetVehicleNumberPlateText func(vehicle float64) string `js:"GetVehicleNumberPlateText()"`
GetVehicleNumberPlateTextIndex func(vehicle float64) float64 `js:"GetVehicleNumberPlateTextIndex()"`
/**
* Gets the vehicle the specified Ped is/was in depending on bool value. This native is used server side when using OneSync.
* @param ped The target ped
* @param lastVehicle False = CurrentVehicle, True = LastVehicle
* @return The vehicle id. Returns 0 if the ped is/was not in a vehicle.
*/
GetVehiclePedIsIn func(ped float64, lastVehicle bool) float64 `js:"GetVehiclePedIsIn()"`
GetVehiclePetrolTankHealth func(vehicle float64) float64 `js:"GetVehiclePetrolTankHealth()"`
GetVehicleRadioStationIndex func(vehicle float64) float64 `js:"GetVehicleRadioStationIndex()"`
GetVehicleRoofLivery func(vehicle float64) float64 `js:"GetVehicleRoofLivery()"`
/**
* Returns the type of the passed vehicle.
* ### Vehicle types
* * automobile
* * bike
* * boat
* * heli
* * plane
* * submarine
* * trailer
* * train
* @param vehicle The vehicle's entity handle.
* @return If the entity is a vehicle, the vehicle type. If it is not a vehicle, the return value will be null.
*/
GetVehicleType func(vehicle float64) string `js:"GetVehicleType()"`
GetVehicleTyreSmokeColor func(vehicle float64) (float64, float64, float64) `js:"GetVehicleTyreSmokeColor()"`
GetVehicleWheelType func(vehicle float64) float64 `js:"GetVehicleWheelType()"`
GetVehicleWindowTint func(vehicle float64) float64 `js:"GetVehicleWindowTint()"`
GiveWeaponComponentToPed func(ped float64, weaponHash interface{}, componentHash interface{}) `js:"GiveWeaponComponentToPed()"`
GiveWeaponToPed func(ped float64, weaponHash interface{}, ammoCount float64, isHidden bool, bForceInHand bool) `js:"GiveWeaponToPed()"`
HasEntityBeenMarkedAsNoLongerNeeded func(vehicle float64) bool `js:"HasEntityBeenMarkedAsNoLongerNeeded()"`
HasVehicleBeenOwnedByPlayer func(vehicle float64) bool `js:"HasVehicleBeenOwnedByPlayer()"`
InvokeFunctionReference func(referenceIdentity string, argsSerialized string, argsLength float64, retvalLength float64) (string, float64) `js:"InvokeFunctionReference()"`
IsAceAllowed func(object string) bool `js:"IsAceAllowed()"`
/**
* Gets whether or not this is the CitizenFX server.
* @return A boolean value.
*/
IsDuplicityVersion func() bool `js:"IsDuplicityVersion()"`
/**
* This native checks if the given entity is visible.
* @return Returns `true` if the entity is visible, `false` otherwise.
*/
IsEntityVisible func(entity float64) bool `js:"IsEntityVisible()"`
/**
* This native checks if the given ped is a player.
* @return Returns `true` if the ped is a player, `false` otherwise.
*/
IsPedAPlayer func(ped float64) bool `js:"IsPedAPlayer()"`
IsPlayerAceAllowed func(playerSrc string, object string) bool `js:"IsPlayerAceAllowed()"`
/**
* Requests whether or not the commerce data for the specified player has loaded.
* @param playerSrc The player handle
* @return A boolean.
*/
IsPlayerCommerceInfoLoaded func(playerSrc string) bool `js:"IsPlayerCommerceInfoLoaded()"`
/**
* Requests whether or not the commerce data for the specified player has loaded from Tebex.
* @param playerSrc The player handle
* @return A boolean.
*/
IsPlayerCommerceInfoLoadedExt func(playerSrc string) bool `js:"IsPlayerCommerceInfoLoadedExt()"`
/**
* This will return true if the player is evading wanted level, meaning that the wanted level stars are blink.
* Otherwise will return false.
* If the player is not wanted, it simply returns false.
* @param playerSrc The target player
* @return boolean value, depending if the player is evading his wanted level or not.
*/
IsPlayerEvadingWantedLevel func(playerSrc string) bool `js:"IsPlayerEvadingWantedLevel()"`
IsPlayerUsingSuperJump func(playerSrc string) bool `js:"IsPlayerUsingSuperJump()"`
IsPrincipalAceAllowed func(principal string, object string) bool `js:"IsPrincipalAceAllowed()"`
IsVehicleEngineStarting func(vehicle float64) bool `js:"IsVehicleEngineStarting()"`
IsVehicleExtraTurnedOn func(vehicle float64, extraId float64) bool `js:"IsVehicleExtraTurnedOn()"`
IsVehicleSirenOn func(vehicle float64) bool `js:"IsVehicleSirenOn()"`
IsVehicleTyreBurst func(vehicle float64, wheelID float64, completely bool) bool `js:"IsVehicleTyreBurst()"`
/**
* Requests the commerce data for the specified player, including the owned SKUs. Use `IS_PLAYER_COMMERCE_INFO_LOADED` to check if it has loaded.
* @param playerSrc The player handle
*/
LoadPlayerCommerceData func(playerSrc string) `js:"LoadPlayerCommerceData()"`
/**
* Requests the commerce data from Tebex for the specified player, including the owned SKUs. Use `IS_PLAYER_COMMERCE_INFO_LOADED` to check if it has loaded.
* @param playerSrc The player handle
*/
LoadPlayerCommerceDataExt func(playerSrc string) `js:"LoadPlayerCommerceDataExt()"`
/**
* Reads the contents of a text file in a specified resource.
* If executed on the client, this file has to be included in `files` in the resource manifest.
* Example: `local data = LoadResourceFile("devtools", "data.json")`
* @param resourceName The resource name.
* @param fileName The file in the resource.
* @return The file contents
*/
LoadResourceFile func(resourceName string, fileName string) string `js:"LoadResourceFile()"`
/**
* Create a permanent voice channel.
* @param id ID of the channel.
*/
MumbleCreateChannel func(id float64) `js:"MumbleCreateChannel()"`
NetworkGetEntityFromNetworkId func(netId float64) float64 `js:"NetworkGetEntityFromNetworkId()"`
/**
* Returns the owner ID of the specified entity.
* @param entity The entity to get the owner for.
* @return On the server, the server ID of the entity owner. On the client, returns the player/slot ID of the entity owner.
*/
NetworkGetEntityOwner func(entity float64) float64 `js:"NetworkGetEntityOwner()"`
/**
* Returns the first owner ID of the specified entity.
* @param entity The entity to get the first owner for.
* @return The server ID of the first entity owner.
*/
NetworkGetFirstEntityOwner func(entity float64) float64 `js:"NetworkGetFirstEntityOwner()"`
NetworkGetNetworkIdFromEntity func(entity float64) float64 `js:"NetworkGetNetworkIdFromEntity()"`
NetworkGetVoiceProximityOverride func(playerSrc string) js.Value `js:"NetworkGetVoiceProximityOverride()"`
PerformHttpRequestInternal func(requestData string, requestDataLength float64) float64 `js:"PerformHttpRequestInternal()"`
PerformHttpRequestInternalEx func(requestData interface{}) float64 `js:"PerformHttpRequestInternalEx()"`
/**
* Prints 'structured trace' data to the server `file descriptor 3` channel. This is not generally useful outside of
* server monitoring utilities.
* @param jsonString JSON data to submit as `payload` in the `script_structured_trace` event.
*/
PrintStructuredTrace func(jsonString string) `js:"PrintStructuredTrace()"`
/**
* Scope entry for profiler.
* @param scopeName Scope name.
*/
ProfilerEnterScope func(scopeName string) `js:"ProfilerEnterScope()"`
/**
* Scope exit for profiler.
*/
ProfilerExitScope func() `js:"ProfilerExitScope()"`
/**
* Returns true if the profiler is active.