Player.SetWeapon

From Liberty Unleashed Wiki
Revision as of 16:13, 25 October 2010 by Force (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function sets the active weapon for the player.

Syntax

  1. bool Player.SetWeapon( int wep, [int ammo] )

Arguments

  • wep - The ID of the weapon to give the player (Found Here)
  • ammo - (optional) The ammo to put in the weapon. Defaults to 250

Example

This will give the player a baseball bat when they type '/bat'

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "bat" )
  5. {
  6. pPlayer.SetWeapon( 1 );
  7. }
  8. return 1;
  9. }
  10.  

Notes

The event onPlayerCommand was used in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox