Skip to main content

Module omp

Module omp 

Source
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
IComponent interface from the Open Multiplayer SDK in pure Rust.
component_api
High-level API for Open Multiplayer server components.
core
Bindings for the ILogger interface of ICore (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 ITimersComponent interface.
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.
IComponentList
IComponentList* — list of loaded components. Received in on_init; use to query other components.
IComponentVTable
Primary IComponent vtable for the MSVC ABI (Windows).
ICore
ICore* — opaque pointer to the Open Multiplayer server core. Received in on_load; use only for caching or future queries.
IEarlyConfig
IEarlyConfig* — configuration during initialization.
IEventDispatcherPawn
Opaque handle for the server’s IEventDispatcher<PawnEventHandler>*.
ILogger
ILogger* — server logging interface.
IPawnScript
Opaque handle for the server’s IPawnScript*.
ITimer
Opaque pointer to the server’s ITimer — returned by create_timer.
ITimersComponent
Opaque pointer to the server’s ITimersComponent.
IUIDProviderVTable
Secondary IUIDProvider vtable for the MSVC ABI (Windows).
OmpComponent
PawnComponent
Typed wrapper for the Open Multiplayer server’s IPawnComponent.
PawnEventHandler
Rust object compatible with Open Multiplayer’s PawnEventHandler*.
PawnEventHandlerVTable
PawnEventHandler vtable for the MSVC ABI (Windows).
SemanticVersion
Semantic version major.minor.patch with pre-release support.
ServerComponentList
Opaque handle for the server’s IComponentList*.
ServerPawnComponent
Opaque handle for the server’s IPawnComponent*.
StringView
Non-owning string — (pointer, length) pair, no \0 terminator.
TimerHandlerVTable
TimerTimeOutHandler vtable — MSVC ABI (this in ECX).
TimerTimeOutHandler
Object the server will invoke on each timer timeout.
TimersComponent
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§

ComponentType
Component type.
LogLevel
Open Multiplayer log level (corresponds to LogLevel in core.hpp).

Constants§

PAWN_COMPONENT_UID
UID of the Open Multiplayer Pawn component (PawnComponent_UID in the SDK).
TIMERS_COMPONENT_UID
UID of the Open Multiplayer Timers component.

Traits§

OmpComponentHandle
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 the IComponent vtable).
component_version
Reads the component version by calling componentVersion() (slot [8] of the IComponent vtable).
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 of logLn.
core_print_ln
ICore::printLn(message) — writes a line to the server log.
core_print_ln_u8
ICore::printLnU8(message) — UTF-8 variant of printLn.
create_repeating_timer
Creates a repeating timer on the Open Multiplayer server.
get_amx_from_script
Extracts the AMX* pointer from an IPawnScript*.
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 ITimersComponent in the server’s component list.
remove_pawn_event_handler
Removes a Pawn event handler from the dispatcher.

Type Aliases§

AmxFunctionTable
Table of 52 AMX function pointers (StaticArray<void*, NUM_AMX_FUNCS>).
UID
64-bit unique identifier of an Open Multiplayer component.