Scripting/Squirrel/Functions/Players/Weapon

From VC-MP Wiki

Jump to: navigation, search

This instance variable returns the weapon player has currently selected.

Syntax

int player.Weapon

Example

This command gives player the name of the weapon they are using when they type '/c mywep'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "mywep" )
     {
          MessagePlayer( "Your current weapon: " + GetWeaponName( player.Weapon ), player );
     }
}

Notes

The functions MessagePlayer, GetWeaponName and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

Related Functions

Personal tools
squirrel scripting