From VC-MP Wiki
Jump to: navigation, search

This is called when a player uses a command.


function onPlayerCommand( player, command, parameters )


  • player - The pointer of the player
  • command - This is the command player used
  • parameters - This is the list of the parameters as a string


This example command slaps the player if they type '/c slap'.

function onPlayerCommand( player, cmd, text )
     if ( cmd == "slap" )
          local pos = player.Pos;
          pos.z += 5;
          player.Pos = pos;
          MessagePlayer( "You slapped yourself! What a fool!", player );


The functions MessagePlayer and player.Pos were used in in this example. More info about them in corresponding pages.

Related Events

Personal tools
squirrel scripting