PlayerCommand: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
Line 4: Line 4:
==Parameters==
==Parameters==
* '''player - player, who send command.'''  
* '''player - player, who send command.'''  
* '''command - string with arguments.'''  
* '''params - the command params.'''  


==Example==
==Example==
Line 10: Line 10:
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
<div style="margin: 10px 10px 10px 10px;"><b>Server-Side</b></div>
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
mp.events.add(
mp.events.addCommand('commandName', (player, _, Name, message) =>  
    {
{
        "playerCommand": (player, command) => {
    //Code
            let args = command.split(/[ ]+/);
     console.log(Name + ' '+ message);
      
});
            const commandName = args.splice(0, 1)[0];
            if (commandName == "meetme") {
                player.outputChatBox("Hello!");
            }
        }
    }
);
</syntaxhighlight>
</syntaxhighlight>
</div>
</div>

Revision as of 21:41, 20 September 2017

This event is triggered when player send command .

Parameters

  • player - player, who send command.
  • params - the command params.

Example

Server-Side
mp.events.addCommand('commandName', (player, _, Name, message) => 
{
    //Code
    console.log(Name + ' '+ message);
});

See also

Checkpoint

Colshape

Entity

Player

Streaming

Vehicle

Waypoint