SpawnClass.Pos

From Liberty Unleashed Wiki
Jump to: navigation, search
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.

Syntax

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

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

Arguments

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

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.

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