PlayerCommand: Difference between revisions
Jack Savage (talk | contribs) No edit summary |
(Undo revision 5908 by Jack Savage (talk)) |
||
| Line 4: | Line 4: | ||
==Parameters== | ==Parameters== | ||
* '''player - player, who send command.''' | * '''player - player, who send command.''' | ||
* ''' | * '''command - string with arguments.''' | ||
==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. | mp.events.add( | ||
{ | { | ||
"playerCommand": (player, command) => { | |||
let args = command.split(/[ ]+/); | |||
}); | |||
const commandName = args.splice(0, 1)[0]; | |||
if (commandName == "meetme") { | |||
player.outputChatBox("Hello!"); | |||
} | |||
} | |||
} | |||
); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</div> | </div> | ||
Revision as of 08:56, 26 September 2017
This event is triggered when player send command .
Parameters
- player - player, who send command.
- command - string with arguments.
Example
Server-Side
mp.events.add(
{
"playerCommand": (player, command) => {
let args = command.split(/[ ]+/);
const commandName = args.splice(0, 1)[0];
if (commandName == "meetme") {
player.outputChatBox("Hello!");
}
}
}
);
See also
Checkpoint
Colshape
Entity
Player
- playerChat
- playerCommand
- playerDamage
- playerDeath
- playerJoin
- playerQuit
- playerReady
- playerSpawn
- playerWeaponChange
Streaming
Vehicle
- playerStartEnterVehicle
- playerEnterVehicle
- playerStartExitVehicle
- playerExitVehicle
- trailerAttached
- vehicleDamage
- vehicleDeath
- vehicleHornToggle
- vehicleSirenToggle