Expand description
Native bindings for the Open Multiplayer SDK.
Independent pure-Rust implementation of the binary ABI of the Open Multiplayer
server: vtables, layout of IComponent/ICore/ITimer, calling
conventions, and subobject offsets. No dependency on the original C++ libs
(robin_hood, glm, nonstd) — only the types sufficient to implement a
component’s lifecycle.
Offsets and slots were confirmed via disasm of Console.dll / Console.so
and omp-server.exe, not by guessing from the C++ headers.
Supports the two i686 ABIs used by the server:
- Itanium (Linux GCC) — calling convention
extern "C" - MSVC (Windows) — calling convention
extern "thiscall"for virtual methods,extern "C"(cdecl) for variadic
Modules§
- component
IComponentinterface from the Open Multiplayer SDK in pure Rust.- component_
api - High-level API for Open Multiplayer server components.
- core
- Bindings for the
ILoggerinterface ofICore(Open Multiplayer). - events
- Pawn script events via
IEventDispatcher<PawnEventHandler>. - server
- Vtables for objects managed by the Open Multiplayer server.
- timers
- Bindings for the Open Multiplayer
ITimersComponentinterface. - types
- Primitive types for the Open Multiplayer ABI:
UID,SemanticVersion,StringView,Colour,Vector{2,3,4},ComponentType. - vtable
- Helpers for accessing vtables (primary and secondary) of server-owned C++ objects.
Structs§
- Colour
- RGBA color.
- IComponent
List IComponentList*— list of loaded components. Received inon_init; use to query other components.- IComponentV
Table - Primary
IComponentvtable for the MSVC ABI (Windows). - ICore
ICore*— opaque pointer to the Open Multiplayer server core. Received inon_load; use only for caching or future queries.- IEarly
Config IEarlyConfig*— configuration during initialization.- IEvent
Dispatcher Pawn - Opaque handle for the server’s
IEventDispatcher<PawnEventHandler>*. - ILogger
ILogger*— server logging interface.- IPawn
Script - Opaque handle for the server’s
IPawnScript*. - ITimer
- Opaque pointer to the server’s
ITimer— returned bycreate_timer. - ITimers
Component - Opaque pointer to the server’s
ITimersComponent. - IUID
ProviderV Table - Secondary
IUIDProvidervtable for the MSVC ABI (Windows). - OmpComponent
- Pawn
Component - Typed wrapper for the Open Multiplayer server’s
IPawnComponent. - Pawn
Event Handler - Rust object compatible with Open Multiplayer’s
PawnEventHandler*. - Pawn
Event HandlerV Table PawnEventHandlervtable for the MSVC ABI (Windows).- Semantic
Version - Semantic version major.minor.patch with pre-release support.
- Server
Component List - Opaque handle for the server’s
IComponentList*. - Server
Pawn Component - Opaque handle for the server’s
IPawnComponent*. - String
View - Non-owning string —
(pointer, length)pair, no\0terminator. - Timer
HandlerV Table TimerTimeOutHandlervtable — MSVC ABI (thisin ECX).- Timer
Time OutHandler - Object the server will invoke on each timer timeout.
- Timers
Component - Typed wrapper for the Open Multiplayer server’s
ITimersComponent. - Vector2
- 2D vector.
- Vector3
- 3D vector — used for world positions in SA-MP/Open Multiplayer.
- Vector4
- 4D vector.
Enums§
- Component
Type - Component type.
- LogLevel
- Open Multiplayer log level (corresponds to
LogLevelincore.hpp).
Constants§
- PAWN_
COMPONENT_ UID - UID of the Open Multiplayer Pawn component (
PawnComponent_UIDin the SDK). - TIMERS_
COMPONENT_ UID - UID of the Open Multiplayer
Timerscomponent.
Traits§
- OmpComponent
Handle - Trait implemented by typed wrappers for Open Multiplayer components.
Functions§
- add_
pawn_ ⚠event_ handler - Registers a Pawn event handler in the dispatcher.
- component_
name - Reads the component name by calling
componentName()(slot [6] of theIComponentvtable). - component_
version - Reads the component version by calling
componentVersion()(slot [8] of theIComponentvtable). - core_
log_ ⚠ln ICore::logLn(level, message)— writes a line with a log level.- core_
log_ ⚠ln_ u8 ICore::logLnU8(level, message)— UTF-8 variant oflogLn.- core_
print_ ⚠ln ICore::printLn(message)— writes a line to the server log.- core_
print_ ⚠ln_ u8 ICore::printLnU8(message)— UTF-8 variant ofprintLn.- create_
repeating_ ⚠timer - Creates a repeating timer on the Open Multiplayer server.
- get_
amx_ ⚠from_ script - Extracts the
AMX*pointer from anIPawnScript*. - get_
amx_ ⚠functions - Gets the pointer to the AMX function table from the
IPawnComponent. - get_
pawn_ ⚠event_ dispatcher - Gets the Pawn event dispatcher from the
IPawnComponent. - kill_
timer ⚠ - Kills an active timer, stopping future fires.
- query_
component ⚠ - Queries a component by UID in the list provided by the server.
- query_
timers_ ⚠component - Queries
ITimersComponentin the server’s component list. - remove_
pawn_ ⚠event_ handler - Removes a Pawn event handler from the dispatcher.
Type Aliases§
- AmxFunction
Table - Table of 52 AMX function pointers (
StaticArray<void*, NUM_AMX_FUNCS>). - UID
- 64-bit unique identifier of an Open Multiplayer component.