Repository navigation
Callbacks
This page documents the Pawn callbacks exposed by cef.inc.
forward OnCefInitialize(playerid, bool:success, E_CEF_INIT_REASON:reason, const message[]);Called when the player's CEF client has completed initialization/handshake.
Example:
public OnCefInitialize(playerid, bool:success, E_CEF_INIT_REASON:reason, const message[])
{
printf("OnCefInitialize player=%d success=%d reason=%d message=%s", playerid, success, _:reason, message);
return 1;
}forward OnCefDownloadStart(playerid);Called when the player starts downloading CEF resources.
forward OnCefDownloadProgress(
playerid,
const fileName[],
filePercent,
totalPercent,
fileDownloadedKb,
fileTotalKb,
totalDownloadedKb,
totalKb
);Called while the server sends resource data to the client.
Parameters:
| Parameter | Meaning |
|---|---|
fileName |
Current resource file being transferred. |
filePercent |
Current file progress, from 0 to 100. |
totalPercent |
Overall resource download progress, from 0 to 100. |
fileDownloadedKb |
Downloaded amount for the current file, in KiB. |
fileTotalKb |
Total size of the current file, in KiB. |
totalDownloadedKb |
Downloaded amount for all queued resources, in KiB. |
totalKb |
Total size of all queued resources, in KiB. |
Use this callback for custom progress UI, such as TextDraw progress bars. OnCefDownloadFinish remains the reliable signal for hiding the UI.
forward OnCefDownloadFinish(playerid);Called when the player finishes downloading CEF resources.
forward OnCefReady(playerid);Called when the client is fully ready after resource download.
Use this if your UI depends on packaged resources being available.
forward OnCefBrowserCreated(playerid, browserid, bool:success, E_CEF_CREATE_STATUS:code, const reason[]);Called after a browser creation request is processed.
Example:
public OnCefBrowserCreated(playerid, browserid, bool:success, E_CEF_CREATE_STATUS:code, const reason[])
{
printf("Browser created: player=%d browser=%d success=%d code=%d reason=%s", playerid, browserid, success, _:code, reason);
return 1;
}forward OnCefPressKey(playerid, key, scancode, modifiers, bool:down, bool:repeat);Called when key capture is enabled and the client forwards a keyboard event.
forward OnCefChatInputState(playerid, bool:open);Called when the chat input open/closed state changes.
Callbacks registered with CEF_RegisterEvent use the callback name you pass.
Example:
CEF_RegisterEvent("inventory:select", "OnInventorySelect", Argument_Integer);
forward OnInventorySelect(playerid, itemid);
public OnInventorySelect(playerid, itemid)
{
printf("Inventory item selected: player=%d item=%d", playerid, itemid);
return 1;
}CEF Plugin — Client & Server for SA-MP / open.mp
Issues & PRs welcome.