Skip to content

Resources and http cef

NeekoGta edited this page Jun 18, 2026 · 2 revisions

Resources and http://cef/

The plugin serves packaged resources through a custom internal HTTP endpoint:

http://cef/<resource_name>/<path>

Directory layout

Server-side resource directory:

scriptfiles/cef/<resource_name>/

Example:

scriptfiles/
  cef/
    demo/
      index.html
      overlay.html
      world2d.html
      world3d.html
      empty.html
      css/app.css
      js/app.js

Register it:

CEF_AddResource("demo");

Load it:

CEF_CreateBrowser(playerid, 1000, "http://cef/demo/index.html", false);

Correct URL format

Correct:

http://cef/demo/index.html
http://cef/demo/css/app.css
http://cef/demo/js/app.js

Incorrect:

cef://demo/index.html
/demo/index.html
file:///...

Vite / React / Vue / frontend builds

For frontend build tools, asset paths must be relative.

Vite example:

import { defineConfig } from "vite";

export default defineConfig({
  base: "./",
});

Why:

  • assets/app.js works inside http://cef/demo/index.html;
  • /assets/app.js points to the root and usually fails.

Common structure for a built frontend

scriptfiles/cef/demo/
  index.html
  assets/
    index-abc123.js
    index-def456.css

Resource download UI modes

When a player is missing packaged resources, the server can choose how the download progress is displayed.

SA-MP server.cfg

cef_resources_loader_mode cef
# cef_resources_loader_mode samp_dialog
# cef_resources_loader_mode none
# cef_resources_loader_dialog_id 32700

Legacy values are still accepted:

cef_resources_loader_ui 1 # same as cef
cef_resources_loader_ui 0 # same as none

open.mp config.json

{
  "cef": {
    "resources_loader_mode": "cef",
    "resources_loader_dialog_id": 32700
  }
}

Available modes:

Mode Behavior
cef Uses the internal CEF loading UI.
samp_dialog Uses a server-side SA-MP/open.mp TABLIST_HEADERS dialog.
none Downloads silently. Use the download callbacks for custom TextDraws or server-side UI.

cef_resources_loader_dialog_id / resources_loader_dialog_id is only used by samp_dialog.

The samp_dialog mode temporarily hides the SA-MP spawn screen during the resource download and restores the gamemode-requested spawn screen state when the download finishes.

Cache notes

If a resource does not update:

  1. Restart the server
  2. Delete the resource .pak if needed
  3. Ensure CEF_AddResource points to the right resource name
  4. Check server logs for resource validation messages

Clone this wiki locally