Repository navigation
[Bug] AddConvarChangeListener does not fire when a convar is created (first set) #588
lilabyte
started this conversation in
[BUG] FiveM for GTAV Enhanced
Replies: 2 comments
|
Hello, |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
A convar change listener (including a wildcard one) is never invoked for the SET that creates a convar. Only subsequent sets fire it. From the listener's perspective the transition from nonexistent to a value is the most significant change a convar can make, and a wildcard subscriber has no other way to learn about new convars. This silently breaks any config system that reacts to convars: an operator typing the first
set my:config:flag trueat the live console sees no effect, while the identical command typed a second time works. Nothing in the convar documentation describes this behaviour.Issue type
Both / Unsure
Repro rate
Always
Server build version
FXServer-early-access b168 linux
OS
Windows 11 Pro 10.0.26200
CPU
13th Gen Intel(R) Core(TM) i5-13600KF
GPU
No response
RAM
No response
Storage type
None
Connection type
None
ISP and bandwidth
No response
DxDiag
No response
Network graph
No response
Platform
Linux
OS version / distribution
Debian 13
CPU
No response
RAM
No response
Using txAdmin?
Yes
Hosting provider
Self-hosted
Machine type
VPS
/perf endpoint output
No response
DDoS protection
No response
ulimit -n value (Linux only)
No response
Docker Compose file (Docker only)
No response
Steps to Reproduce
Repro resource (JS, no dependencies):
fxmanifest.lua
server.js
Steps (server console, nothing else needed):
ensurethe resource.set repro_creation a- NOTHING is logged by either listener (bug). The convar did get created:repro_get repro_creationprintsrepro_creation = "a".set repro_creation b- BOTH listeners log the change:[repro][wildcard] convar changed: repro_creation = "b"and[repro][exact] convar changed: repro_creation = "b".set repro_creation bagain (same value) - nothing is logged, so the listener clearly fires on value changes. The creation in step 2 was a value change too (nonexistent to "a") and still produced nothing.setr repro_creation2 ais silent,setr repro_creation2 blogs.Expected Behavior
Step 2 should invoke the listener: the convar's value changed from nonexistent to "a", and a wildcard listener in particular is the only mechanism a script has for discovering newly created convars.
Actual Behavior
The creating set is silent and only the second and later sets fire the listener. Scripts that cache convar-driven config and refresh it from the change listener permanently miss the first value unless the convar was declared in server.cfg before they started.
Evidence
No response
Additional Context
No response
All reactions