-
-
Notifications
You must be signed in to change notification settings - Fork 36
Quick Start
NeekoGta edited this page Jun 17, 2026
·
2 revisions
This guide creates a minimal Overlay2D browser from Pawn.
Create:
scriptfiles/cef/hello/index.html<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>omp-cef hello</title>
<style>
html, body {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: transparent;
font-family: Arial, sans-serif;
}
.panel {
position: absolute;
left: 32px;
top: 32px;
padding: 18px 22px;
color: white;
background: rgba(0, 0, 0, .75);
border: 1px solid rgba(255, 255, 255, .35);
border-radius: 8px;
}
</style>
</head>
<body>
<div class="panel">
<h1>omp-cef</h1>
<p>Hello from <code>http://cef/hello/index.html</code></p>
</div>
</body>
</html>public OnGameModeInit()
{
CEF_AddResource("hello");
return 1;
}new bool:gCefReady[MAX_PLAYERS];
public OnCefInitialize(playerid, bool:success, E_CEF_INIT_REASON:reason, const message[])
{
gCefReady[playerid] = success;
if (success)
SendClientMessage(playerid, -1, "CEF ready. Use /hellocef.");
else
SendClientMessage(playerid, -1, "CEF failed to initialize.");
return 1;
}#define HELLO_BROWSER_ID 1000
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/hellocef", true))
{
if (!gCefReady[playerid])
{
SendClientMessage(playerid, -1, "CEF is not ready yet.");
return 1;
}
CEF_CreateBrowser(
playerid,
HELLO_BROWSER_ID,
"http://cef/hello/index.html",
false,
true,
0.0,
0.0
);
return 1;
}
if (!strcmp(cmdtext, "/hidecef", true))
{
CEF_SetBrowserVisible(playerid, HELLO_BROWSER_ID, false);
return 1;
}
if (!strcmp(cmdtext, "/showcef", true))
{
CEF_SetBrowserVisible(playerid, HELLO_BROWSER_ID, true);
return 1;
}
if (!strcmp(cmdtext, "/destroycef", true))
{
CEF_DestroyBrowser(playerid, HELLO_BROWSER_ID);
return 1;
}
return 0;
}After connecting:
- Wait for
CEF ready; - type
/hellocef; - The browser panel appears at the top-left of the screen.
CEF Plugin — Client & Server for SA-MP / open.mp
Issues & PRs welcome.