Adds its include files, with the libraries it depends on, to the Pawn compiler in your browser, ready to include in a script.
README.md
omprs
omprs is a tool to develop open.mp gamemodes and components in Rust.
Structure
| Crate | Description |
|---|---|
omp-codegen | Generates exported functions and FFI related code automatically |
omp-sdk | GDK crate, that does the core functionality like loading function address, executing, providing necessary types etc |
omp | The main crate the is supposed to be used by the component or server developers, neatly exposing all of the functionalities and APIs. |
Writing my first gamemode in Rust
Download and install latest open.mp C-API component from here
Create a new rust project
cargo new mygm --libAdd
ompto dependeciescargo add ompAdd this to your
Cargo.toml[lib] crate-type = ["cdylib"]Write a basic code like this
use omp::{events::Events, main, register, types::colour::Colour}; struct MyGM; impl Events for MyGM { fn on_player_connect(&mut self, player: omp::players::Player) { player.send_client_message(Colour::from_rgba(0xFFFFFFFF), "Welcome to my server!"); } } #[main] pub fn game_main() { register!(MyGM); }Build your gamemode or component
cargo +stable-i686 buildPut the compile
mygm.dllormygm.sotocomponentsfolderRun your server
Character Encoding (Non-ASCII Text)
By default, omp passes Rust's UTF-8 strings directly across the FFI boundary (CodePage::UTF8). Because the GTA:SA / SA-MP client expects single-byte Windows ANSI code pages for non-ASCII scripts (such as Windows-1251 for Cyrillic), configure the matching CodePage in your #[main] function:
use omp::{main, register, set_code_page, CodePage};
#[main]
pub fn game_main() {
set_code_page(CodePage::Windows1251);
register!(MyGM);
}
This page is built from what GitHub publishes about the repository. samp.directory does not host the code. Report a problem with this listing