Docs Crates

samp-rs

samp-rs is a tool to develop plugins for samp servers written in rust.

documentation

it's here! need to find a way to fix docs.rs ...

project structure

usage

[dependencies] samp = "0.1.2" ``` * write your first plugin

migration from old versions

examples

struct Plugin;

impl SampPlugin for Plugin { // this function executed when samp server loads your plugin fn on_load(&mut self) { println!("Plugin is loaded."); } }

impl Plugin { #[native(name = "TestNative")] fn mynative(&mut self, _amx: &Amx, text: AmxString) -> AmxResult { let text = text.tostring(); // convert amx string into rust string println!("rust plugin: {}", text);

    Ok(true)
}

}

initializeplugin!( natives: [Plugin::mynative], { let plugin = Plugin; // create a plugin object return plugin; // return the plugin into runtime } ) ```