pub fn enable_debug_hook(amx: &Amx)Expand description
Installs the SDK’s debug hook on amx, routing every executed line into
SampPlugin::on_debug_break. Call from SampPlugin::on_amx_load for
each AMX you want to debug (typically the gamemode).
The .amx must have been compiled with -d2/-d3 for the VM to invoke the
hook. To stop receiving callbacks, call disable_debug_hook.
This is the turnkey alternative to Amx::install_debug_hook: instead of
managing a raw extern "C" callback and global state yourself, the SDK owns
a panic-guarded trampoline and dispatches into your plugin instance.
§Example
ⓘ
impl SampPlugin for MyDebugger {
fn on_amx_load(&mut self, amx: &Amx) {
samp::plugin::enable_debug_hook(amx);
}
fn on_debug_break(&mut self, amx: &Amx) {
let line = amx.cip();
// inspect / pause / forward to a DAP client...
}
}