Plugin★ 53actualizado abr 2024Sin licenciaRust
Abrir en GitHubEste repositorio no tiene archivo de licencia. Se puede leer, pero eso por sí solo no da permiso para reutilizarlo.
Probar en el compilador de Pawn →
Añade sus archivos include, con las librerías de las que depende, al compilador de Pawn de tu navegador, listos para incluirlos en un script.
readme.md
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
sampis a glue between crates described below (that's what you need).samp-codegengenerates rawextern "C"functions and does whole nasty job.samp-sdkcontains all types to work with amx.
usage
- install rust compiler (supports only
i686os versions because of samp server arch). - add in your
Cargo.tomlthis:
[lib]
crate-type = ["cdylib"] # or dylib
[dependencies]
samp = "0.1.2"
- write your first plugin
migration from old versions
- check out the guide
examples
- simple memcache plugin in
plugin-examplefolder. - your
lib.rsfile
use samp::prelude::*; // export most useful types
use samp::{native, initialize_plugin}; // codegen macros
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 my_native(&mut self, _amx: &Amx, text: AmxString) -> AmxResult<bool> {
let text = text.to_string(); // convert amx string into rust string
println!("rust plugin: {}", text);
Ok(true)
}
}
initialize_plugin!(
natives: [Plugin::my_native],
{
let plugin = Plugin; // create a plugin object
return plugin; // return the plugin into runtime
}
)
amxbindingspluginpluginsrustsampsamp-pluginsamp-sdksdk
Esta página se genera con lo que GitHub publica sobre el repositorio. samp.directory no aloja el código. Informar de un problema con esta ficha