Squirrel/Server/Functions/SpawnClass/Pos

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example 2. Setting)
 
Line 1: Line 1:
 +
{{Squirrel/Title|SpawnClass.Pos}}
 
__NOTOC__
 
__NOTOC__
 
This ''SpawnClass'' class member returns or sets the spawn position for the given spawn class.
 
This ''SpawnClass'' class member returns or sets the spawn position for the given spawn class.

Latest revision as of 10:07, 11 October 2010

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


This SpawnClass class member returns or sets the spawn position for the given spawn class.

[edit] Syntax

You can either return or set a new value using this member:

  1. Vector SpawnClass.Pos
  1. SpawnClass.Pos = Vector vPos

[edit] Arguments

  • vPos - This is the new spawn position for the class as a vector.

[edit] Example 1. Returning

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "getpos" )
  5. {
  6. local pos = p_SpawnClass.Pos;
  7. MessagePlayer( "The current spawn class position is: " + pos, player );
  8. }
  9. }
  10.  

This example will return the position of the spawn class, that we found earlier in FindSpawnClass.

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "setpos" )
  5. {
  6. local pos = player.Pos, newpos = Vector( pos.x, pos.y, pos.z );
  7. p_SpawnClass.Pos = newpos;
  8. }
  9. }
  10.  

This example will set the position of the spawn class, that we found earlier in FindSpawnClass, to the players current position.

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox