pub enum EventReturn {
Continue,
Suppress(i32),
}Expand description
What the SDK does with the gamemode’s public after an event handler runs.
A #[event] handler may return this type to influence the callback. Handlers
that instead return AmxResult<T> / T are pure observers: their value
is ignored and the original public always runs (equivalent to Continue).
Variants§
Continue
Let the gamemode’s own public run as usual. The default for observers.
Suppress(i32)
Skip the gamemode’s public entirely; the callback returns this raw cell
to its caller. Use to cancel a callback (e.g. reject a command in
OnPlayerCommandText by returning EventReturn::Suppress(1)).
The value is a raw AMX cell. For a typed return (f32, bool, …) use
EventReturn::suppress, which encodes the value to a cell for you.
Implementations§
Source§impl EventReturn
impl EventReturn
Sourcepub fn suppress<T: CellConvert>(value: T) -> Self
pub fn suppress<T: CellConvert>(value: T) -> Self
Suppresses the callback, returning value encoded as an AMX cell.
Convenience over Suppress(i32) for callbacks whose Pawn return type is
not a plain integer — a Float: callback wants the bit pattern of the
f32, a bool: callback wants 0/1. CellConvert handles the
encoding, so EventReturn::suppress(1.5_f32) and
EventReturn::suppress(true) do the right thing.
#[event(name = "OnPlayerRequestScore")]
fn on_score(&mut self, _amx: &Amx, _id: i32) -> EventReturn {
EventReturn::suppress(1.5_f32) // Float: callback, returns 1.5
}Trait Implementations§
Source§impl Clone for EventReturn
impl Clone for EventReturn
Source§fn clone(&self) -> EventReturn
fn clone(&self) -> EventReturn
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more