Squirrel/Server/Functions/Players/SetAnim

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
 
Line 12: Line 12:
 
== Example ==
 
== Example ==
  
{{Squirrel/NeedsExample}}
+
This will play the specified anim when the player types '/anim <anim id>'
Explanation for the example
+
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( pPlayer, szCommand, szText )
 +
{
 +
if ( szCommand == "anim" )
 +
{
 +
if ( szText ) pPlayer.SetAnim( szText.tointeger() );
 +
}
 +
 +
return 1;
 +
}
 
</code>
 
</code>
  
 
=== Notes ===
 
=== Notes ===
  
-- List of used functions and other notes here.
+
The event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in this example. More info about this in the corresponding page.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Players}}
 
{{Squirrel/Server/Functions/Players}}

Latest revision as of 16:09, 25 October 2010

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

This function sets players animation.

[edit] Syntax

  1. bool player.SetAnim( int anim )

[edit] Arguments

  • anim - The ID of the animation to play

[edit] Example

This will play the specified anim when the player types '/anim <anim id>'

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

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox