OnPlayerCommand

From Vice City Multiplayer [MIRROR]
Jump to: navigation, search

This is called when a player uses a command.

Syntax

function onPlayerCommand( player, cmd, parameters )

Parameters

  • Player player - The player that used the command.
  • string cmd - The command that player used.
  • string text - List of command parameters as string.

Example

This example command heal the player if they type /heal.

<source lang=squirrel> function onPlayerCommand( player, cmd, text ) {

if ( cmd == "heal" )
{
 if ( player.Health == 100 ) PrivMessage( player, "You have the health to maximum.");
 else 
 {
  PrivMessage( player, "You healed successfully.");
  player.Health = 100;
}

} </source>

Notes

Call onPlayerCommand were used in this example. More info about them in the corresponding pages.

Related Functions

  • onPlayerChat( player, message )
  • onPlayerCommand( player, command, arguments )
  • onPlayerPM( player, playerTo, message )