Hooks/Server/onChatCommand

From Official DarkRP Wiki
Jump to: navigation, search
Hook
Hook name onChatCommand(Player ply, string command, string arguments, table return)
Description:
Called after a player has run any chat command or uses the DarkRP console command. Note: the chat command has already been run. Use canChatCommand if you want to stop chat commands from being run.
Returns: string overrideText, function overrideSayFunc
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.darkrp.com/index.php?title=Hooks/Server/onChatCommand]onChatCommand hook[/url][/b]

Parameters

  1. ply (Player)
  2. The player who spoke.

  3. command (string)
  4. The thing they said.

  5. arguments (string)
  6. The arguments of the chat command, given either as one string or a table of strings. That depends on whether the command is declared to use table arguments.

  7. return (table)
  8. The return value of the chat command function. Should contain a chat text override and/or a say function. See the return values of this hook for a description

Return values

  1. overrideText (string)
  2. Overrides the text a chat command will put in everyone's chat box. Return nil to not change behaviour.

  3. overrideSayFunc (function)
  4. Say functions handle what needs to be said to whom. The say function for PMs for example make sure only the sender and receiver see the message. You can override this behaviour by returning a different say function in this hook. Return nil to not change behaviour.