Squirrel/Server/Functions/Players/WeaponState

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Syntax)
(Syntax)
 
Line 6: Line 6:
 
<code>int player.WeaponState</code>
 
<code>int player.WeaponState</code>
  
State 0 = Idle weapon
+
* State 0 - Idle weapon
State 1 = Firing weapon
+
* State 1 - Firing weapon
State 2 = Reloading weapon
+
* State 2 - Reloading weapon
  
 
== Arguments ==
 
== Arguments ==

Latest revision as of 19:30, 25 October 2010

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function returns the state of the weapon the player is currently holding. (e.g. reloading)

[edit] Syntax

  1. int player.WeaponState
  • State 0 - Idle weapon
  • State 1 - Firing weapon
  • State 2 - Reloading weapon

[edit] Arguments

  • none

[edit] Example

This will tell the player what their weapon is currently doing when type '/wepstate'

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "wepstate" )
  5. {
  6. MessagePlayer( "Your current weapon state is - " + pPlayer.WeaponState, pPlayer );
  7. }
  8. return 1;
  9. }
  10.  

[edit] Notes

The function MessagePlayer and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox