Skip to content

0x617374726F/omprs-gdk

 
 

Repository files navigation

omprs

crates.io docs.rs build status patreon kofi

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

  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

About

Rust SDK to write open.mp game modes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%