Conversation
…acks backwards
GetTrackNodesInRadius skipped a track when
includeDisabledTracks && !track->m_enabled
so asking to include disabled tracks excluded them, and the default of
false - what every caller passes, the parameter being undocumented -
never filtered at all, returning nodes on tracks switched off with
SET_TRACK_ENABLED. Both branches are inverted relative to the flag's
name and default. Every other m_enabled check in the file reads the flag
the expected way round (FindClosestTrack, the any-track-enabled check,
SET/IS_TRACK_ENABLED). The condition has been this way since the native
was added in 76ab6c5.
Negate the flag so disabled tracks are skipped unless explicitly
requested. The function is static with a single call site.
The declaration is updated in the same change so it never documents the
inverted behaviour: the fifth parameter is added to the signature and
parameter list, and a duplicated "## Return value" section is collapsed.
Not exercised in-game; the code change is one negation on one condition.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Veqta <217806377+VeqtaDev@users.noreply.github.com>
|
Can you stop spamming AI PRs holy fuck |
Indeed, whenever claude is co authored it should just close the PR and maybe block the user 👍 |
I don't see the problems here mates if the code is good and it upgrade the community experience this should not be ignored, but if the code is shitty ai slop yeah ur right but then argument and look closely to an real code report it will always be better to scream at people for AI code ;) |
its not about the fact its AI, its that youre just spamming 100 PRs |
Also, remove "Cfx contributor" from your github readme, you've not contributed anything yet as nothing of yours has been merged |
hes goated 400 contributions in 1 day |
If u could symply think with ur brain u should know that as soon you post anything on the cfx page whereas script or else you are a contributor of the ecosystem so since you like so much sucking my dick because i use ai i do some PR to enhance community playing quality go make some u too unless you want to keep wasting time barking like a dog for an AI PR. Wake Up Bro its 2026... |
thats not how open source contribution works. |
|
none merged btw |
|
I do not understand the issue as long as the code produced is readable and has value. You should be grateful that some people are still spending time on this rotting repository knowing it will likely be ignored by cfx. Now you also get trash talked on by white knights somehow, its cfx role to decide wether this is acceptable or not |

Goal of this PR
GET_CLOSEST_TRACK_NODEStakes anincludeDisabledTracksflag that does the opposite of its name, and the flag is not documented at all, so the native currently returns nodes on tracks that were switched off withSET_TRACK_ENABLEDand offers no discoverable way to avoid that.How is this PR achieving the goal
The bug.
GetTrackNodesInRadiusinextra-natives-five/src/TrackNatives.cppskips a track with:When
includeDisabledTracksistrue, a disabled track is skipped. When it isfalse— the default, and what every caller passes today since the parameter is undocumented — the condition can never be true, so disabled tracks are always returned. Both branches are inverted relative to the parameter's name and its= falsedefault.Every other use of
m_enabledin the same file reads it the expected way round:FindClosestTrackskips!track->m_enabled(line 162), the "any track enabled" check returns ontrack->m_enabled(line 304), andSET_TRACK_ENABLED/IS_TRACK_ENABLEDwrite and read it directly. The condition has been this way since the native was introduced in 76ab6c5.The fix is the single negation the name implies:
if (!track || (!includeDisabledTracks && !track->m_enabled))GetTrackNodesInRadiusisstaticwith one call site, the native handler, so nothing else observes the change.Behaviour change for existing scripts: callers passing four arguments now get nodes on enabled tracks only, which is what
SET_TRACK_ENABLED's own page says disabling a track is for ("mission trains will not be able to spawn on this track"). Anyone who actually wants disabled tracks can now ask for them withtrue.Documentation.
GetClosestTrackNodes.mdis updated in the same change so the page never describes the inverted behaviour: the fifth parameter is added to the signature and parameter list, and a duplicated## Return valuesection (the file had two) is collapsed into one.Verification
Executed, not just reasoned. I extracted the skip predicate — the master line and the PR line, verbatim — into a small harness around the same mock track table and compiled it with MSVC 19.51 (Visual Studio 2026,
/W4 /WX, zero warnings). Output:The process exit code is an assertion over the three claims in this PR (master's default leaks disabled tracks; the fix's default does not; the fix's
trueopts them back in), so the run is pass/fail, not just a printout.Harness source (drop in a file,
cl /EHsc /std:c++17 track_filter.cpp, run)In-game test resource (drop into a dev server, run
/tracktestnear a railway)tracktest/fxmanifest.luatracktest/client.luaExpected on master: after the track is disabled, the 4-argument count does not drop while the count with
truedoes — the inversion. Expected with this PR: the reverse. The resource restores the track's previous state when it finishes.What this does not cover: the change has not been built inside the FiveM tree or exercised in-game — I have neither a build environment nor a test server. The in-tree diff is a single
!on one condition, the static case (every otherm_enabledreference in the file, and the original commit) is laid out above, and the resource above turns the in-game check into a one-command step for anyone with a dev server.This PR applies to the following area(s)
FiveM, Natives
Successfully tested on
Game builds: not run in-game — predicate verified in isolation, see Verification.
Platforms: Windows
Checklist
Note on CI
This touches
code/, so the full build matrix runs and the PR will be auto-labelledinvalid. That failure is environmental and predates this branch — Windows jobs abort at exit 127 before MSBuild runs. Described in #4178, fix proposed in #4179.Fixes issues
N/A
🤖 Generated with Claude Code