Skip to main content

Custom F1 panel

The F1 panel is the f1menu/ folder next to client_packages/ (the same place as loadingscreen/). Edit its index.html, style.css and app.js, and link any other files with relative paths. Without an f1menu/ folder, F1 does nothing.

It is delivered like the loading screen: the launcher downloads it with the other server files (encrypted), and connected players get a changed version on their next reconnect.

When F1 works​

  • Only after a successful connect, once the loading screen is gone and the player is in the world.
  • Never while GTA loads, while connecting or downloading, or while reconnecting. A dropped connection closes it.
  • While it is open it owns the mouse and keyboard: the game and the gamemode's key binds get nothing. Esc or F1 closes it.

The panel is the topmost layer, over the gamemode UI, with the cursor drawn on top. The page is transparent wherever you do not paint. It is isolated: the gamemode cannot see or control it, and it cannot talk to the gamemode.

note

A native <select> dropdown does not open in an in-game browser. Draw your own list.

API​

The client pushes its state into the page:

window.addEventListener('syncf1:state', function (e) { render(e.detail); });
if (window.__syncf1) render(window.__syncf1); // state that arrived before your listener

e.detail​

FieldMeaning
opentrue while the panel is open (animate your entrance on it)
connectedThe link to the server is up
server"host:port"
playerNameThe player's name from the launcher
voice.inputDevices / voice.outputDevicesMicrophone / speaker names
voice.inputDevice / voice.outputDeviceThe chosen device ("" = system default)
voice.inputVolume / voice.outputVolume0..1 — microphone level / other players' voice level
voice.noiseSuppressiontrue / false
voice.micTestWhether "hear yourself" is running

Commands the page sends​

The page talks back with console.log lines:

LineEffect
SYNCF1|readySend me the state now
SYNCF1|closeClose the panel
SYNCF1|reconnectDrop the connection and reconnect
SYNCF1|quitLeave the server and close the game
SYNCF1|refreshDevicesList the audio devices again
SYNCF1|monitor|1Hold the microphone open for a level meter (|0 stops). The level arrives ~20×/s as syncf1:level events, e.detail = 0..1
SYNCF1|micTest|1Hear yourself (|0 stops). Nothing is sent to other players meanwhile
SYNCF1|testOutputPlay a short chime on the chosen output device
SYNCF1|set|inputDevice|<name>Choose the microphone ("" = default)
SYNCF1|set|outputDevice|<name>Choose the output device
SYNCF1|set|inputVolume|0.8Microphone level
SYNCF1|set|outputVolume|0.8Voice output level
SYNCF1|set|noiseSuppression|1Noise suppression on/off

The client switches monitor and micTest off whenever the panel closes.

Every set applies to voice chat immediately and is saved in client_settings.json next to the player's client. Saved settings apply at every start, even if F1 is never opened. The volumes are the player's own levels: they multiply whatever the gamemode sets and never replace it.