SpawnClass.AddWeapon

From Liberty Unleashed Wiki
Revision as of 10:39, 11 October 2010 by VRocker (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 adds a new spawn weapon for the given slot of a SpawnClass.

Syntax

  1. int SpawnClass.AddWeapon( int weapon [, int ammo [, int slot ] ] )

Arguments

  • weapon - The weapon model to add
  • ammo - How much ammo for the spawn weapon should be added. This is an optional argument, defaults to 100 if not used
  • slot - The slot you want to set the new weapon for. There are 12 slots available. This is an optional argument, finds the first free slot by default. Returns false if no free slots are available

Example

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "addwep" )
  5. {
  6. if ( text ) p_SpawnClass.AddWeapon( text.tointeger(), 500 );
  7. }
  8. }
  9.  

This example will add the specified weapon, with 500 ammo to the spawn class that we found earlier in FindSpawnClass.

Notes

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

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox