Skip to main content

SampPlugin

Derive Macro SampPlugin 

Source
#[derive(SampPlugin)]
Expand description

Generates impl SampPlugin for T {} with all methods using the default behavior (empty). Use for structs that do not need to customize any lifecycle callback — write the impl SampPlugin manually when some method needs custom logic.

use samp::prelude::*;

#[derive(SampPlugin)]
struct SimplePlugin { counter: u32 }

// With logic in on_load → do not use the derive
struct AdvancedPlugin;
impl SampPlugin for AdvancedPlugin {
    fn on_load(&mut self) { println!("plugin loaded"); }
}