Scripting/Squirrel/Events/Player/onPlayerCommand
From VC-MP Wiki
This is called when a player uses a command.
Syntax
function onPlayerCommand( player, command, parameters )
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
Example
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 ); } }
Notes
The functions MessagePlayer and player.Pos were used in in this example. More info about them in corresponding pages.
Related Events
- onPlayerJoin
- onPlayerPart
- onPlayerCrashDump
- onPlayerSpawn
- onPlayerDeath
- onPlayerKill
- onPlayerTeamKill
- onPlayerChat
- onPlayerAction
- onPlayerPM
- onPlayerFailedPM
- onPlayerTeamChat
- onPlayerCommand
- onPlayerHealthChange
- onPlayerArmourChange
- onPlayerWeaponChange
- onPlayerCashChange
- onPlayerScoreChange
- onPlayerKeyStateChange
- onPlayerMove
- onPlayerRequestClass
- onPlayerRequestAmmunation
- onPlayerRequestAmmuWeapon
- onPlayerStartSpectating
- onPlayerExitSpectating
- onPlayerRconLogin
- onPlayerRconLoginAttempt
- onPlayerFall
- onPlayerVersion