gtac-types 0.0.1
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/LICENSE +201 -0
- package/README.md +435 -0
- package/bin/gtac.js +35 -0
- package/index.js +6 -0
- package/lib/build.js +186 -0
- package/package.json +51 -0
- package/src/index.d.ts +22 -0
- package/src/runtime/shared/constants.ts +146 -0
- package/src/runtime/shared/utils.ts +26 -0
- package/src/types/client/animations.d.ts +902 -0
- package/src/types/client/events.d.ts +809 -0
- package/src/types/client/functions.d.ts +715 -0
- package/src/types/client/gta.d.ts +724 -0
- package/src/types/client/natives.d.ts +1091 -0
- package/src/types/element.d.ts +853 -0
- package/src/types/event.d.ts +100 -0
- package/src/types/misc.d.ts +256 -0
- package/src/types/resource.d.ts +252 -0
- package/src/types/server/client.d.ts +144 -0
- package/src/types/server/events.d.ts +407 -0
- package/src/types/server/functions.d.ts +890 -0
- package/src/types/vec.d.ts +594 -0
- package/src/types/xml.d.ts +232 -0
- package/templates/meta.xml +4 -0
- package/templates/tsconfig.json +12 -0
|
@@ -0,0 +1,853 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GTAC Element Hierarchy Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Defines the complete GTA Connected world-object hierarchy.
|
|
5
|
+
* All in-game objects (vehicles, peds, players, pickups, markers, blips, etc.)
|
|
6
|
+
* derive from the base `Element` interface, forming a tree structure with
|
|
7
|
+
* parent/child relationships, position, rotation, and custom data storage.
|
|
8
|
+
*
|
|
9
|
+
* @module types/element
|
|
10
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Check if a player is in a vehicle
|
|
14
|
+
* function isPlayerInVehicle(player: Player): boolean {
|
|
15
|
+
* return player.vehicle !== null;
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Store custom data on any element
|
|
20
|
+
* element.setData("owner", "Tommy");
|
|
21
|
+
* const owner = element.getData("owner"); // "Tommy"
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// ===== Element Hierarchy =====
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Base element type — all GTA Connected world objects derive from Element.
|
|
28
|
+
*
|
|
29
|
+
* Every element has a unique numeric ID, a position in the world, a parent/child
|
|
30
|
+
* hierarchy, and a key/value store for custom data. Elements can be assigned
|
|
31
|
+
* to dimensions (isolated worlds that don't interact) and controlled via
|
|
32
|
+
* network synchronisation flags.
|
|
33
|
+
*
|
|
34
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
35
|
+
*/
|
|
36
|
+
interface Element {
|
|
37
|
+
/**
|
|
38
|
+
* Unique numeric element ID assigned by the server.
|
|
39
|
+
* Every element in the world has a distinct ID.
|
|
40
|
+
*/
|
|
41
|
+
id: number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Element type constant.
|
|
45
|
+
* One of: `ELEMENT_ELEMENT`, `ELEMENT_ENTITY`, `ELEMENT_PHYSICAL`,
|
|
46
|
+
* `ELEMENT_PED`, `ELEMENT_PLAYER`, `ELEMENT_VEHICLE`, `ELEMENT_BLIP`,
|
|
47
|
+
* `ELEMENT_OBJECT`, `ELEMENT_TRAIN`, `ELEMENT_PICKUP`, `ELEMENT_MARKER`,
|
|
48
|
+
* `ELEMENT_BUILDING`, `ELEMENT_CIVILIAN`, `ELEMENT_TRANSFORMABLE`.
|
|
49
|
+
*/
|
|
50
|
+
type: number;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Displayable name for the element.
|
|
54
|
+
* Can be set at creation time and used to identify elements by name.
|
|
55
|
+
*/
|
|
56
|
+
name: string;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Parent element in the hierarchy, or `null` if this element is a root
|
|
60
|
+
* (top-level) element. Elements attached to a parent move/rotate with it.
|
|
61
|
+
*/
|
|
62
|
+
parent: Element | null;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Array of child elements directly attached to this element.
|
|
66
|
+
* Children inherit position/rotation from their parent.
|
|
67
|
+
*/
|
|
68
|
+
children: Element[];
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* World position of this element as a 3D vector.
|
|
72
|
+
* Represented as a `Vec3` with `x`, `y`, `z` components in world units.
|
|
73
|
+
*/
|
|
74
|
+
position: Vec3;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Rotation of this element as a 3D vector.
|
|
78
|
+
* Components represent pitch (x), yaw (y), and roll (z) in degrees.
|
|
79
|
+
*/
|
|
80
|
+
rotation: Vec3;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Dimension ID this element belongs to.
|
|
84
|
+
* Elements in different dimensions cannot see or interact with each other.
|
|
85
|
+
* The default dimension is 0.
|
|
86
|
+
*/
|
|
87
|
+
dimension: number;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The `Resource` that created this element, or `null` if the element
|
|
91
|
+
* was created by the engine or is a built-in element.
|
|
92
|
+
*/
|
|
93
|
+
resource: Resource | null;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The `Client` responsible for network synchronisation of this element,
|
|
97
|
+
* or `null` if no client is the current syncer.
|
|
98
|
+
*/
|
|
99
|
+
syncer: Client | null;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Whether this element was created on the local client (client-side only).
|
|
103
|
+
* Always `false` on the server.
|
|
104
|
+
*/
|
|
105
|
+
isLocal: boolean;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Whether the local client is the owner of this element.
|
|
109
|
+
* Ownership is used for authority decisions (e.g. who can delete it).
|
|
110
|
+
*/
|
|
111
|
+
isOwner: boolean;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Whether the local client is the network syncer for this element.
|
|
115
|
+
* The syncer sends position/state updates to the server.
|
|
116
|
+
*/
|
|
117
|
+
isSyncer: boolean;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Distance (in world units) at which this element starts streaming in
|
|
121
|
+
* for clients. Elements beyond this distance are not loaded.
|
|
122
|
+
*/
|
|
123
|
+
streamInDistance: number;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Distance (in world units) at which this element streams out for clients.
|
|
127
|
+
* When a client is farther than this distance, the element is unloaded.
|
|
128
|
+
*/
|
|
129
|
+
streamOutDistance: number;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The `Client` this element currently exists for (is streamed in to),
|
|
133
|
+
* or `null` if the element is synced to all clients.
|
|
134
|
+
*/
|
|
135
|
+
existsFor: Client | null;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Network synchronisation flags controlling how this element's
|
|
139
|
+
* position, rotation, and state are synced between server and clients.
|
|
140
|
+
*/
|
|
141
|
+
netFlags: NetFlags;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Retrieves a custom data value previously stored on this element.
|
|
145
|
+
* Values are dynamically typed (SpiderMonkey engine — no static type enforcement).
|
|
146
|
+
*
|
|
147
|
+
* @param key - The string key identifying the stored data.
|
|
148
|
+
* @returns The stored value, or `undefined` if no data exists for the key.
|
|
149
|
+
*/
|
|
150
|
+
getData(key: string): any;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Stores a custom data value on this element.
|
|
154
|
+
* Data persists for the lifetime of the element and is accessible on both
|
|
155
|
+
* server and client sides.
|
|
156
|
+
*
|
|
157
|
+
* @param key - The string key to store the data under.
|
|
158
|
+
* @param value - Any value to store (number, string, object, array, etc.).
|
|
159
|
+
*/
|
|
160
|
+
setData(key: string, value: any): void;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Removes a custom data key and its associated value from this element.
|
|
164
|
+
*
|
|
165
|
+
* @param key - The string key to remove.
|
|
166
|
+
*/
|
|
167
|
+
removeData(key: string): void;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Checks whether this element matches a given element type constant.
|
|
171
|
+
* Useful for type-checking elements without relying on `instanceof`.
|
|
172
|
+
*
|
|
173
|
+
* @param type - The type constant to check against (e.g. `ELEMENT_VEHICLE`).
|
|
174
|
+
* @returns `true` if this element is of the given type.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* if (element.isType(ELEMENT_PLAYER)) {
|
|
178
|
+
* const player = element as Player;
|
|
179
|
+
* message(player.name + " is a player!");
|
|
180
|
+
* }
|
|
181
|
+
*/
|
|
182
|
+
isType(type: number): boolean;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Sets which `Client` is responsible for network synchronisation of this element.
|
|
186
|
+
* Changing the syncer migrates authority over position/state updates.
|
|
187
|
+
*
|
|
188
|
+
* @param client - The client to assign as the new syncer.
|
|
189
|
+
*/
|
|
190
|
+
setSyncer(client: Client): void;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Entity — a positioned element with heading, interior, transformation matrix,
|
|
195
|
+
* bounding volumes, and collision data.
|
|
196
|
+
*
|
|
197
|
+
* Extends `Element` with spatial properties: orientation, bounding boxes/spheres,
|
|
198
|
+
* and collision geometry. Entities are the base for physical objects, buildings,
|
|
199
|
+
* peds, and vehicles.
|
|
200
|
+
*
|
|
201
|
+
* @extends Element
|
|
202
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
203
|
+
*/
|
|
204
|
+
interface Entity extends Element {
|
|
205
|
+
/**
|
|
206
|
+
* Heading (yaw orientation) of the entity in degrees.
|
|
207
|
+
* 0° = north, 90° = east, 180° = south, 270° = west.
|
|
208
|
+
*/
|
|
209
|
+
heading: number;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Interior ID identifying which interior (building interior) the entity is in.
|
|
213
|
+
* 0 = outside/exterior.
|
|
214
|
+
*/
|
|
215
|
+
interior: number;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* 4x4 transformation matrix combining position, rotation, and scale
|
|
219
|
+
* into a single mathematical representation.
|
|
220
|
+
*/
|
|
221
|
+
matrix: Matrix4x4;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Visual transparency/opacity of the entity.
|
|
225
|
+
* 0 = fully transparent, 255 = fully opaque.
|
|
226
|
+
* **Client-side only** — not available on the server.
|
|
227
|
+
*/
|
|
228
|
+
alpha: number;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Centre point of the entity's bounding box in world coordinates.
|
|
232
|
+
* **Client-side only.**
|
|
233
|
+
*/
|
|
234
|
+
boundingCentre: Vec3;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Minimum corner of the entity's axis-aligned bounding box (AABB)
|
|
238
|
+
* in world coordinates.
|
|
239
|
+
*/
|
|
240
|
+
boundingMin: Vec3;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Maximum corner of the entity's axis-aligned bounding box (AABB)
|
|
244
|
+
* in world coordinates.
|
|
245
|
+
*/
|
|
246
|
+
boundingMax: Vec3;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Radius of the bounding sphere that encloses the entity's geometry.
|
|
250
|
+
* Used for distance checks and collision culling.
|
|
251
|
+
*/
|
|
252
|
+
boundingRadius: number;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Whether collision detection is enabled for this entity.
|
|
256
|
+
* When `false`, the entity passes through other colliders.
|
|
257
|
+
*/
|
|
258
|
+
collisionsEnabled: boolean;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Number of collision (col) boxes comprising this entity's collision mesh.
|
|
262
|
+
*/
|
|
263
|
+
collisionBoxCount: number;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Raw collision box data array.
|
|
267
|
+
* Format/schema depends on the game engine — engine-specific.
|
|
268
|
+
*/
|
|
269
|
+
collisionBoxes: any[];
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Number of collision lines (edges) in the collision mesh.
|
|
273
|
+
*/
|
|
274
|
+
collisionLineCount: number;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Raw collision line data array.
|
|
278
|
+
* Engine-specific format.
|
|
279
|
+
*/
|
|
280
|
+
collisionLines: any[];
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Number of collision spheres in the collision mesh.
|
|
284
|
+
*/
|
|
285
|
+
collisionSphereCount: number;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Raw collision sphere data array.
|
|
289
|
+
* Engine-specific format.
|
|
290
|
+
*/
|
|
291
|
+
collisionSpheres: any[];
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Number of vertices in the collision mesh.
|
|
295
|
+
*/
|
|
296
|
+
collisionVertexCount: number;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Raw collision vertex data array.
|
|
300
|
+
* Engine-specific format.
|
|
301
|
+
*/
|
|
302
|
+
collisionVertices: any[];
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Distance from the entity's centre of mass to the base of its 3D model.
|
|
306
|
+
* Used for physics and ground-clamping calculations.
|
|
307
|
+
*/
|
|
308
|
+
distanceFromCentreOfMassToBaseOfModel: number;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Building — a static GTA world-geometry element.
|
|
313
|
+
*
|
|
314
|
+
* Buildings represent non-interactive world geometry (roads, buildings, terrain
|
|
315
|
+
* pieces) loaded from IPL/IDE files. They have a model index but no physics,
|
|
316
|
+
* velocity, or health properties.
|
|
317
|
+
*
|
|
318
|
+
* @extends Entity
|
|
319
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
320
|
+
*/
|
|
321
|
+
interface Building extends Entity {
|
|
322
|
+
/**
|
|
323
|
+
* GTA model index identifying which visual model this building uses.
|
|
324
|
+
* Corresponds to entries in the game's IDE (Item Definition) files.
|
|
325
|
+
*/
|
|
326
|
+
modelIndex: number;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Physical — an entity that interacts with the physics engine.
|
|
331
|
+
*
|
|
332
|
+
* Extends `Entity` with mass, gravity multiplier, and linear/angular velocity.
|
|
333
|
+
* Physical elements participate in collision resolution and can be affected
|
|
334
|
+
* by forces. Base for `Object`, `Ped`, and `Vehicle`.
|
|
335
|
+
*
|
|
336
|
+
* @extends Entity
|
|
337
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
338
|
+
*/
|
|
339
|
+
interface Physical extends Entity {
|
|
340
|
+
/**
|
|
341
|
+
* Gravity multiplier applied to this physical entity.
|
|
342
|
+
* 1.0 = normal gravity, 0.0 = no gravity, negative = reverse gravity.
|
|
343
|
+
*/
|
|
344
|
+
gravity: number;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Mass of the entity for physics calculations (in arbitrary game units).
|
|
348
|
+
* Heavier entities require more force to move and deal more collision damage.
|
|
349
|
+
*/
|
|
350
|
+
mass: number;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Linear velocity vector in world units per tick.
|
|
354
|
+
* Describes the direction and speed the entity is currently moving.
|
|
355
|
+
*/
|
|
356
|
+
velocity: Vec3;
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Angular (rotational) velocity vector in radians per tick.
|
|
360
|
+
* Describes the rotation speed around each axis.
|
|
361
|
+
*/
|
|
362
|
+
turnVelocity: Vec3;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Object — a placeable physical item with a GTA model.
|
|
367
|
+
*
|
|
368
|
+
* Objects are static or dynamic physical entities with a visual model.
|
|
369
|
+
* Common uses: furniture, props, barriers, weapons on the ground, etc.
|
|
370
|
+
*
|
|
371
|
+
* @extends Physical
|
|
372
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* // Create a barrel object
|
|
376
|
+
* const barrel = gta.createObject(1225, 0, 0, 10, 0, 0, 0);
|
|
377
|
+
* barrel.gravity = 1.0;
|
|
378
|
+
*/
|
|
379
|
+
interface Object extends Physical {
|
|
380
|
+
/**
|
|
381
|
+
* GTA model index identifying which visual model this object uses.
|
|
382
|
+
*/
|
|
383
|
+
modelIndex: number;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Ped — a pedestrian character with health, armour, and vehicle occupancy.
|
|
388
|
+
*
|
|
389
|
+
* Peds are AI-controlled or player-controlled characters that walk, run,
|
|
390
|
+
* fight, and interact with the world. They have health/armour, can hold weapons,
|
|
391
|
+
* and can occupy vehicle seats.
|
|
392
|
+
*
|
|
393
|
+
* @extends Physical
|
|
394
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* // Check if a ped is alive
|
|
398
|
+
* function isPedAlive(ped: Ped): boolean {
|
|
399
|
+
* return ped.health > 0;
|
|
400
|
+
* }
|
|
401
|
+
*/
|
|
402
|
+
interface Ped extends Physical {
|
|
403
|
+
/**
|
|
404
|
+
* Armour value (0–100).
|
|
405
|
+
* Armour absorbs damage before health is affected.
|
|
406
|
+
*/
|
|
407
|
+
armour: number;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Whether the ped is frozen in place.
|
|
411
|
+
* Frozen peds cannot move, fall, or react to physics.
|
|
412
|
+
*/
|
|
413
|
+
frozen: boolean;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Health value. 100 = full health, 0 = dead/wasted.
|
|
417
|
+
* Values above 100 are possible (overhealed).
|
|
418
|
+
*/
|
|
419
|
+
health: number;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* GTA model index for the ped's appearance/skin.
|
|
423
|
+
* See the PedSkin enum for human-readable constants.
|
|
424
|
+
*/
|
|
425
|
+
modelIndex: number;
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* The `Vehicle` this ped is currently occupying, or `null` if on foot.
|
|
429
|
+
*/
|
|
430
|
+
occupiedVehicle: Vehicle | null;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Seat index the ped is sitting in within their occupied vehicle.
|
|
434
|
+
* 0 = driver seat, 1 = front passenger, 2+ = rear seats.
|
|
435
|
+
*/
|
|
436
|
+
occupyingSeat: number;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Player — a ped controlled by a connected client.
|
|
441
|
+
*
|
|
442
|
+
* Players extend `Ped` with multiplayer-specific properties: team, wanted level,
|
|
443
|
+
* money, weapons, and player colours. Only `Player` entities are directly
|
|
444
|
+
* controlled by human clients.
|
|
445
|
+
*
|
|
446
|
+
* @extends Ped
|
|
447
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* // Give a player money and a weapon
|
|
451
|
+
* function equipPlayer(player: Player): void {
|
|
452
|
+
* player.money += 500;
|
|
453
|
+
* player.giveWeapon(22, 100, true); // Pistol with 100 ammo
|
|
454
|
+
* }
|
|
455
|
+
*/
|
|
456
|
+
interface Player extends Ped {
|
|
457
|
+
/**
|
|
458
|
+
* Player skin/appearance ID.
|
|
459
|
+
* Determines the character model used for this player.
|
|
460
|
+
*/
|
|
461
|
+
skin: number;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Team ID for team-based game modes.
|
|
465
|
+
* Use 0 for no team.
|
|
466
|
+
*/
|
|
467
|
+
team: number;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Wanted level (0–6 stars).
|
|
471
|
+
* Controls police response intensity. 0 = no wanted level.
|
|
472
|
+
*/
|
|
473
|
+
wantedLevel: number;
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* The `Vehicle` the player is currently inside, or `null` if on foot.
|
|
477
|
+
* Alias for `occupiedVehicle` with better naming for players.
|
|
478
|
+
*/
|
|
479
|
+
vehicle: Vehicle | null;
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Player's current money amount.
|
|
483
|
+
* Positive values represent dollars the player has.
|
|
484
|
+
*/
|
|
485
|
+
money: number;
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Whether the player is currently sitting inside a vehicle.
|
|
489
|
+
* Convenience property — equivalent to checking `vehicle !== null`.
|
|
490
|
+
*/
|
|
491
|
+
isInVehicle: boolean;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Whether the player is invincible (cannot take damage).
|
|
495
|
+
*/
|
|
496
|
+
invincible: boolean;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Currently equipped weapon ID.
|
|
500
|
+
* 0 = unarmed/fists. See the Weapon enum for IDs.
|
|
501
|
+
*/
|
|
502
|
+
weapon: number;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Array of all weapon IDs the player currently owns.
|
|
506
|
+
* Does not include ammo counts — use `getWeaponAmmunition()` for that.
|
|
507
|
+
*/
|
|
508
|
+
weapons: number[];
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Primary player colour (used on the radar blip and name tag).
|
|
512
|
+
*/
|
|
513
|
+
colour1: number;
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Secondary player colour (used for the blip border).
|
|
517
|
+
*/
|
|
518
|
+
colour2: number;
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Gives a weapon to the player with the specified ammunition.
|
|
522
|
+
*
|
|
523
|
+
* @param weaponId - Weapon ID to give (see Weapon enum).
|
|
524
|
+
* @param ammo - Amount of ammunition to provide.
|
|
525
|
+
* @param equip - If `true`, the weapon is immediately equipped.
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* // Give the player a loaded M4 rifle and equip it
|
|
529
|
+
* player.giveWeapon(26, 200, true);
|
|
530
|
+
*/
|
|
531
|
+
giveWeapon(weaponId: number, ammo: number, equip: boolean): void;
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Returns the remaining ammunition count for a given weapon.
|
|
535
|
+
*
|
|
536
|
+
* @param weapon - Weapon ID to query.
|
|
537
|
+
* @returns Ammo count, or `0` if the player does not own the weapon.
|
|
538
|
+
*/
|
|
539
|
+
getWeaponAmmunition(weapon: number): number;
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Sets the ammunition count for a given weapon.
|
|
543
|
+
* The player must already own the weapon.
|
|
544
|
+
*
|
|
545
|
+
* @param weapon - Weapon ID to modify.
|
|
546
|
+
* @param ammo - New ammunition count.
|
|
547
|
+
*/
|
|
548
|
+
setWeaponAmmunition(weapon: number, ammo: number): void;
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Respawns the player at their designated spawn point.
|
|
552
|
+
* If no spawn point has been set, the default spawn location is used.
|
|
553
|
+
*
|
|
554
|
+
* @example
|
|
555
|
+
* // Respawn a dead player
|
|
556
|
+
* if (player.health <= 0) {
|
|
557
|
+
* player.health = 100;
|
|
558
|
+
* player.spawn();
|
|
559
|
+
* }
|
|
560
|
+
*/
|
|
561
|
+
spawn(): void;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Vehicle — a driveable vehicle with colours, damage states, doors, wheels,
|
|
566
|
+
* and occupant support.
|
|
567
|
+
*
|
|
568
|
+
* Vehicles are the primary transportation method in GTA. They have health,
|
|
569
|
+
* engine state, door/wheel damage, towing/trailer capabilities, and can hold
|
|
570
|
+
* multiple occupants.
|
|
571
|
+
*
|
|
572
|
+
* @extends Physical
|
|
573
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
574
|
+
*
|
|
575
|
+
* @example
|
|
576
|
+
* // Lock a vehicle and turn off its engine
|
|
577
|
+
* function immobilizeVehicle(veh: Vehicle): void {
|
|
578
|
+
* veh.isLocked = true;
|
|
579
|
+
* veh.engineState = false;
|
|
580
|
+
* }
|
|
581
|
+
*/
|
|
582
|
+
interface Vehicle extends Physical {
|
|
583
|
+
/**
|
|
584
|
+
* GTA model index identifying the vehicle type (e.g. Infernus = 141).
|
|
585
|
+
* See the VehicleModel enum for named constants.
|
|
586
|
+
*/
|
|
587
|
+
modelIndex: number;
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Primary vehicle colour ID (0–255).
|
|
591
|
+
* Maps to the car colour palette defined in carcols.dat.
|
|
592
|
+
*/
|
|
593
|
+
color1: number;
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Secondary vehicle colour ID (0–255).
|
|
597
|
+
*/
|
|
598
|
+
color2: number;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Primary vehicle colour ID (alias for `color1`).
|
|
602
|
+
*/
|
|
603
|
+
colour1: number;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Secondary vehicle colour ID (alias for `color2`).
|
|
607
|
+
*/
|
|
608
|
+
colour2: number;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Tertiary colour ID. Used by some vehicle models with three-colour schemes.
|
|
612
|
+
*/
|
|
613
|
+
color3: number;
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Quaternary colour ID. Used by some vehicle models with four-colour schemes.
|
|
617
|
+
*/
|
|
618
|
+
color4: number;
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Array of door state values, indexed by door position.
|
|
622
|
+
* See `AUTOMOBILEDOORSTATUS_*` constants for possible values.
|
|
623
|
+
*/
|
|
624
|
+
doorStates: number[];
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Engine health value.
|
|
628
|
+
* When this reaches 0, the engine catches fire and the vehicle explodes.
|
|
629
|
+
*/
|
|
630
|
+
engineHealth: number;
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Whether the engine is currently running.
|
|
634
|
+
* `true` = engine on, `false` = engine off.
|
|
635
|
+
*/
|
|
636
|
+
engineState: boolean;
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Yaw heading of the vehicle in degrees.
|
|
640
|
+
*/
|
|
641
|
+
heading: number;
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Vehicle body health value.
|
|
645
|
+
* 1000 = full health, 0 = destroyed. Visual damage appears below 500.
|
|
646
|
+
*/
|
|
647
|
+
health: number;
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Whether the vehicle doors are locked.
|
|
651
|
+
* Locked vehicles cannot be entered by players.
|
|
652
|
+
*/
|
|
653
|
+
isLocked: boolean;
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Whether the police siren is active.
|
|
657
|
+
*/
|
|
658
|
+
isSirenOn: boolean;
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Light state of the vehicle's headlights.
|
|
662
|
+
* 0 = off, 1 = on.
|
|
663
|
+
*/
|
|
664
|
+
lights: number;
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Number of occupants currently inside the vehicle.
|
|
668
|
+
*/
|
|
669
|
+
occupantCount: number;
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Paint job ID (for vehicles that support custom paint jobs, e.g. lowriders).
|
|
673
|
+
*/
|
|
674
|
+
paintJob: number;
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Licence plate text displayed on the vehicle.
|
|
678
|
+
* Max 8 characters.
|
|
679
|
+
*/
|
|
680
|
+
plateText: string;
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* The `Vehicle` being towed by this vehicle, or `null` if not towing.
|
|
684
|
+
*/
|
|
685
|
+
towingVehicle: Vehicle | null;
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* The `Vehicle` acting as a trailer attached to this vehicle, or `null`.
|
|
689
|
+
*/
|
|
690
|
+
trailer: Vehicle | null;
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Array of wheel state values, indexed by wheel position.
|
|
694
|
+
* States indicate normal, burst, or missing wheels.
|
|
695
|
+
*/
|
|
696
|
+
wheelStates: number[];
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Returns all `Player` entities currently occupying this vehicle.
|
|
700
|
+
*
|
|
701
|
+
* @returns Array of `Player` in the vehicle (includes driver and passengers).
|
|
702
|
+
*
|
|
703
|
+
* @example
|
|
704
|
+
* // Kick everyone out of a vehicle
|
|
705
|
+
* vehicle.getOccupants().forEach(p => {
|
|
706
|
+
* p.vehicle = null;
|
|
707
|
+
* });
|
|
708
|
+
*/
|
|
709
|
+
getOccupants(): Player[];
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Train — a vehicle that follows train tracks with connected carriages.
|
|
714
|
+
*
|
|
715
|
+
* Trains are special vehicles constrained to rail paths. They can have multiple
|
|
716
|
+
* connected carriage elements and follow predefined track routes.
|
|
717
|
+
*
|
|
718
|
+
* @extends Vehicle
|
|
719
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
720
|
+
*/
|
|
721
|
+
interface Train extends Vehicle {
|
|
722
|
+
/**
|
|
723
|
+
* Whether this vehicle is a train (always `true` for `Train` instances).
|
|
724
|
+
*/
|
|
725
|
+
isTrain: boolean;
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Array of connected train carriages attached to this train engine.
|
|
729
|
+
*/
|
|
730
|
+
carriage: Train[];
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Track ID identifying which rail route this train follows.
|
|
734
|
+
* Track definitions are loaded from the game's path files.
|
|
735
|
+
*/
|
|
736
|
+
track: number;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Blip — a radar icon displayed on the minimap.
|
|
741
|
+
*
|
|
742
|
+
* Blips represent points of interest on the player's radar/minimap.
|
|
743
|
+
* They can be positioned at fixed coordinates or attached to elements.
|
|
744
|
+
*
|
|
745
|
+
* @extends Element
|
|
746
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
747
|
+
*
|
|
748
|
+
* @example
|
|
749
|
+
* // Create a blip at some world coordinates
|
|
750
|
+
* const blip = gta.createBlip(new Vec3(100, 200, 10), 0);
|
|
751
|
+
*/
|
|
752
|
+
interface Blip extends Element {}
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Marker — a 3D world marker (checkpoint, arrow, cylinder, etc.).
|
|
756
|
+
*
|
|
757
|
+
* Markers are visible 3D indicators in the game world. They can be used as
|
|
758
|
+
* checkpoints, arrows pointing to locations, or navigation guides.
|
|
759
|
+
*
|
|
760
|
+
* @extends Element
|
|
761
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
762
|
+
*
|
|
763
|
+
* @example
|
|
764
|
+
* // Create a red checkpoint marker
|
|
765
|
+
* const marker = gta.createMarker(0, 0, 10, 0, 1, 255, 0, 0, 255);
|
|
766
|
+
*/
|
|
767
|
+
interface Marker extends Element {
|
|
768
|
+
/**
|
|
769
|
+
* Marker colour as an RGBA tuple (red, green, blue, alpha; 0–255 each).
|
|
770
|
+
*/
|
|
771
|
+
color: RGBA;
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Target world position this marker should point toward (for arrow-type markers).
|
|
775
|
+
*/
|
|
776
|
+
targetPosition: Vec3;
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Marker type ID determining the marker's visual shape.
|
|
780
|
+
* Common types: cylinder, arrow, checkpoint ring, etc.
|
|
781
|
+
*/
|
|
782
|
+
type: number;
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Whether the marker is currently visible to players.
|
|
786
|
+
*/
|
|
787
|
+
visible: boolean;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* Pickup — a collectible item placed in the game world.
|
|
792
|
+
*
|
|
793
|
+
* Pickups are spawned items (weapons, health, armour, money, bribes, etc.)
|
|
794
|
+
* that are collected when a player walks over them. Some pickups respawn
|
|
795
|
+
* after a set delay.
|
|
796
|
+
*
|
|
797
|
+
* @extends Element
|
|
798
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
799
|
+
*
|
|
800
|
+
* @example
|
|
801
|
+
* // Create a health pickup
|
|
802
|
+
* const healthPickup = gta.createPickup(366, 1, 0, 0, 10);
|
|
803
|
+
*/
|
|
804
|
+
interface Pickup extends Element {
|
|
805
|
+
/**
|
|
806
|
+
* Amount of ammunition or quantity provided when this pickup is collected.
|
|
807
|
+
* For weapon pickups, this is the ammo count.
|
|
808
|
+
*/
|
|
809
|
+
amount: number;
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Ammunition count provided by this pickup.
|
|
813
|
+
* Synonym for `amount` — used in weapon pickup contexts.
|
|
814
|
+
*/
|
|
815
|
+
amu: number;
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Whether this pickup respawns after being collected.
|
|
819
|
+
* `true` = respawn after a delay, `false` = one-time pickup.
|
|
820
|
+
*/
|
|
821
|
+
respawns: boolean;
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Pickup type ID determining what kind of item this is.
|
|
825
|
+
* See PickupType enum for possible values (weapon, health, armour, etc.).
|
|
826
|
+
*/
|
|
827
|
+
type: number;
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Quantity of the item provided by this pickup.
|
|
831
|
+
* For money pickups, this is the dollar amount.
|
|
832
|
+
*/
|
|
833
|
+
quantity: number;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* Sphere — an invisible 3D trigger zone with a position and radius.
|
|
838
|
+
*
|
|
839
|
+
* Spheres are used to detect when players/peds/vehicles enter a defined area.
|
|
840
|
+
* Created via `gta.createSphere()`. They fire enter/exit events when entities
|
|
841
|
+
* cross the sphere boundary.
|
|
842
|
+
*
|
|
843
|
+
* @extends Element
|
|
844
|
+
* @see https://wiki.gtaconnected.com — GTA Connected Wiki
|
|
845
|
+
*
|
|
846
|
+
* @example
|
|
847
|
+
* // Create a trigger zone and listen for entry
|
|
848
|
+
* const zone = gta.createSphere(new Vec3(0, 0, 10), 5.0);
|
|
849
|
+
* addEventHandler("OnElementStreamIn", function(el) {
|
|
850
|
+
* message("Element entered the zone!");
|
|
851
|
+
* });
|
|
852
|
+
*/
|
|
853
|
+
interface Sphere extends Element {}
|