samp.directory
← Scripts et bibliothèques

Sreyas-Sreelal/omprs-gdk

Rust SDK to write open.mp game modes

Plugin★ 20mis à jour nov. 2025Apache-2.0Rust
Ouvrir sur GitHub
L’essayer dans le compilateur Pawn →

Ajoute ses fichiers include, avec les bibliothèques dont il dépend, au compilateur Pawn de ton navigateur, prêts à être inclus dans un script.

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

Cette page est construite à partir de ce que GitHub publie sur le dépôt. samp.directory n’héberge pas le code. Signaler un problème avec cette fiche

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