samp.directory
← Skrypty i biblioteki

Sreyas-Sreelal/omprs-gdk

Rust SDK to write open.mp game modes

Plugin★ 20zaktualizowano lis 2025Apache-2.0Rust
Otwórz na GitHubie
Wypróbuj w kompilatorze Pawn →

Dodaje jej pliki include, razem z bibliotekami, od których zależy, do kompilatora Pawn w twojej przeglądarce, gotowe do dołączenia w skrypcie.

README.md

omprs

omprs is a tool to develop open.mp gamemodes and components in Rust.

Structure

CrateDescription
omp-codegenGenerates exported functions and FFI related code automatically
omp-sdkGDK crate, that does the core functionality like loading function address, executing, providing necessary types etc
ompThe 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

  1. Download and install latest open.mp C-API component from here

  2. Create a new rust project cargo new mygm --lib

  3. Add omp to dependecies cargo add omp

  4. Add this to your Cargo.toml

    [lib]
    crate-type = ["cdylib"]
    
  5. 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);
    }
    
  6. Build your gamemode or component

    cargo +stable-i686 build

  7. Put the compile mygm.dll or mygm.so to components folder

  8. Run your server

componentompopenmprustsamp

Ta strona jest zbudowana z tego, co GitHub publikuje o repozytorium. samp.directory nie hostuje kodu. Zgłoś problem z tym wpisem

Sreyas-Sreelal/omprs-gdk: Plugin SA-MP | samp.directory