OnPlayerCommand

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search

onPlayerCommand

Triggered when a player submits a slash command that was not consumed before event dispatch.

Availability

This event is available in server-side scripts.

Callback signature

onPlayerCommand(playerId, commandName, argumentLine)

Parameters

Name Type Description
playerId int The player that submitted the command.
commandName string The lowercase command name without the leading slash.
argumentLine string The unparsed text following the command name.

Examples

Handle the event:

addEventHandler("onPlayerCommand", root, function(playerId, commandName, argumentLine)
    outputDebugString("/" .. commandName .. " from player " .. playerId .. ": " .. argumentLine)
end)

Notes

  • Prefer addCommandHandler for ordinary commands; use this event for centralized routing or auditing.