Macro samp_sdk::new_plugin [] [src]

macro_rules! new_plugin {
    (@internal $name:ident) => { ... };
    ($name:ident) => { ... };
    ($name:ident with process_tick) => { ... };
}

Hides ugly C code from your eyes.

Generates raw extern C functions and makes call to your own static methods.

Examples

struct MyPlugin;
 
impl MyPlugin {
    fn load(&self) -> bool {
        amx_log!("My plugin is loaded!");
        return true;
    }
     
    fn unload(&self);
    fn amx_load(&self, amx: AMX) -> Cell;
    fn amx_unload(&self, amx: AMX) -> Cell;
}

impl Default for MyPlugin {
    fn default() -> MyPlugin {
        MyPlugin{}
    }
}
 
new_plugin!(MyPlugin) 

To make a plugin with ProccessTick support use this:

impl MyPlugin {
    fn process_tick(&self);
}

new_plugin!(MyPlugin with process_tick);