Table of Contents

Class ConsoleCommandDispatchContext

Namespace
SampSharp.Entities.SAMP.Commands
Assembly
SampSharp.OpenMp.Entities.Commands.dll

Provides context and message handler for a console command execution. Wraps the open.mp ConsoleCommandSenderData and provides a convenient interface for command handlers.

public class ConsoleCommandDispatchContext
Inheritance
ConsoleCommandDispatchContext
Inherited Members

Constructors

ConsoleCommandDispatchContext(Player?, Action<string>?)

Initializes a new instance from console sender data.

public ConsoleCommandDispatchContext(Player? player, Action<string>? messageHandler = null)

Parameters

player Player

The player who sent the command (null if sent from server console).

messageHandler Action<string>

Optional handler to send response messages.

Properties

MessageHandler

Optional handler to send response messages back to the console/player.

public Action<string>? MessageHandler { get; }

Property Value

Action<string>

Player

The player who invoked this console command, or null if invoked from server console.

public Player? Player { get; }

Property Value

Player

Methods

SendMessage(string)

Sends a message via the MessageHandler if available.

public void SendMessage(string message)

Parameters

message string

The message to send.