Custom loading screen
Your loading screen is the loadingscreen/ folder next to client_packages/. Edit its
index.html, and put any CSS, JS, images, fonts or music it needs in the same folder, linked with
relative paths (style.css, img/bg.jpg).
The page is shown:
- from the moment GTA starts until the player is in the world and the gamemode has started;
- again as soon as the connection drops ("Connection lost, reconnecting").
The launcher downloads it together with the other server files (encrypted, like
client_packages), so players see it from the first frame. Without a loadingscreen/ folder the
client shows its built-in page.
Keep it light: every player downloads it before anything else, and the server warns above 50 MB. After you change it, connected players get the new version on their next reconnect; everyone else gets it from the launcher on their next start.
API
The client pushes its state into the page, and the page only draws it:
window.addEventListener('syncmp:state', function (e) { render(e.detail); });
if (window.__syncmp) render(window.__syncmp); // state that arrived before your listener
e.detail
| Field | Meaning |
|---|---|
stage | "game" GTA itself is loading · "connecting" · "checking" comparing files with the server · "downloading" (see progress, files, bytes) · "loading" loading the world / starting the gamemode · "ready" in the world: fade out, the page stops being drawn ~1 s later · "reconnecting" the connection was lost and the client is reconnecting · "disconnected" the server sent the player away (kick/ban), see reason |
text | Default English text for the stage (use it, or localise by stage) |
progress | 0..1 while downloading, -1 otherwise |
files | { done, total } |
bytes | { done, total } |
server | "host:port" |
reason | Why the connection ended ("server restarting", "connection lost", kick reason) |
attempt | Reconnect attempt number |
retryIn | Seconds until the next reconnect attempt |
notice | An important one-line message (for example "restart the game to load new DLC packs") |
After "ready" the page can be shown again ("reconnecting"), so undo your fade-out whenever the
stage is anything other than "ready".
The page has no window.mp: it cannot talk to the gamemode, and the gamemode cannot see it. It
may load web content (fonts, CDN video), but files in the folder load fastest and work offline.