-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(extra-natives/five): add getters for new track junction
- Loading branch information
1 parent
0dec7bf
commit e24873b
Showing
5 changed files
with
180 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
ns: CFX | ||
apiset: client | ||
game: gta5 | ||
--- | ||
## GET_TRACK_JUNCTION_COUNT | ||
|
||
```c | ||
int GET_TRACK_JUNCTION_COUNT(); | ||
``` | ||
|
||
|
||
## Return value | ||
Returns the number of track junctions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
ns: CFX | ||
apiset: client | ||
game: gta5 | ||
--- | ||
## GET_TRACK_JUNCTION_FROM_NODES | ||
|
||
```c | ||
int GET_TRACK_JUNCTION_FROM_NODES(int trackIndex, int trackNode, int newIndex, int newNode, bool direction); | ||
``` | ||
## Examples | ||
```lua | ||
local onTrack = 0 | ||
local onNode = 3899 | ||
local newTrack = 1 | ||
local newNode = 83 | ||
local direction = true | ||
local junctionId = RegisterTrackJunction(onTrack, onNode, newTrack, newNode, direction) | ||
print(("The junctionId is %s"):format(junctionId)) | ||
local retrievedJunctionId = GetTrackJunctionFromNodes(onTrack, onNode, newTrack, newNode, direction) | ||
if retrievedJunctionId ~= -1 then | ||
print(('The junction is valid, junctionId %i'):format(retrievedJunctionId)) | ||
else | ||
print('The junctionId is invalid') | ||
end | ||
``` | ||
|
||
## Parameters | ||
* **trackIndex**: The track index a train should be on | ||
* **trackNode**: The node a train should be on | ||
* **newIndex**: The new track index for a train to be placed on | ||
* **newNode**: The new track node for a train to be placed on | ||
* **direction**: The direction a train should be traveling for this junction | ||
|
||
## Return value | ||
Returns the junction id for the given nodes, or -1 if no junction exists. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
ns: CFX | ||
apiset: client | ||
game: gta5 | ||
--- | ||
## GET_TRACK_JUNCTION_INFO | ||
|
||
```c | ||
bool GET_TRACK_JUNCTION_INFO(int junctionId, int* trackIndex, int* trackNode, int* newIndex, int* newNode, bool* direction); | ||
``` | ||
## Examples | ||
```lua | ||
local onTrack = 0 | ||
local onNode = 3899 | ||
local newTrack = 1 | ||
local newNode = 83 | ||
local direction = true | ||
local junctionId = RegisterTrackJunction(onTrack, onNode, newTrack, newNode, direction) | ||
print(("The junctionId is %s"):format(junctionId)) | ||
local success, _onTrack, _onNode, _newTrack, _newNode, _direction = GetTrackJunctionInfo(junctionId) | ||
if success then | ||
print(('The junction is valid, on track %i, on node %i, new track %i, new node %i, direction %s'):format(_onTrack, _onNode, _newTrack, _newNode, _direction and 'true' or 'false')) | ||
else | ||
print('The junctionId is invalid') | ||
end | ||
``` | ||
|
||
## Parameters | ||
* **junctionId**: The track junction handle | ||
* **trackIndex**: The track index a train should be on | ||
* **trackNode**: The node a train should be on | ||
* **newIndex**: The new track index for a train to be placed on | ||
* **newNode**: The new track node for a train to be placed on | ||
* **direction**: The direction a train should be traveling for this junction | ||
|
||
## Return value | ||
Returns true if junction id is valid, false otherwise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
ns: CFX | ||
apiset: client | ||
game: gta5 | ||
--- | ||
## IS_TRACK_JUNCTION_ACTIVE | ||
|
||
```c | ||
bool IS_TRACK_JUNCTION_ACTIVE(int junctionId, bool* isActive); | ||
``` | ||
## Parameters | ||
* **junctionId**: The track junction handle | ||
* **isActive**: Whether the track junction is active | ||
## Return value | ||
Returns true if junction id is valid, false otherwise. |