Squirrel/Server/Functions/SpawnClass/Pos
From Liberty Unleashed Wiki
(Difference between revisions)
(→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
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:
Vector SpawnClass.Pos
SpawnClass.Pos = Vector vPos
[edit] Arguments
- vPos - This is the new spawn position for the class as a vector.
[edit] Example 1. Returning
function onPlayerCommand( player, cmd, text ) { if ( cmd == "getpos" ) { local pos = p_SpawnClass.Pos; MessagePlayer( "The current spawn class position is: " + pos, player ); } }
This example will return the position of the spawn class, that we found earlier in FindSpawnClass.
function onPlayerCommand( player, cmd, text ) { if ( cmd == "setpos" ) { local pos = player.Pos, newpos = Vector( pos.x, pos.y, pos.z ); p_SpawnClass.Pos = newpos; } }
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.