Squirrel/Server/Functions/SpawnClass/Angle
From Liberty Unleashed Wiki
(Difference between revisions)
(→Example 1. Returning) |
|||
Line 1: | Line 1: | ||
− | + | {{Squirrel/Title|SpawnClass.Angle}} | |
This ''SpawnClass'' class member returns or sets the spawn rotation for the given spawn class. | This ''SpawnClass'' class member returns or sets the spawn rotation for the given spawn class. | ||
Latest revision as of 10:38, 11 October 2010
This SpawnClass class member returns or sets the spawn rotation for the given spawn class.
[edit] Syntax
You can either return or set a new value using this member:
float SpawnClass.Angle
SpawnClass.Angle = float angle
[edit] Arguments
- angle - This is the new spawn rotation for the class
[edit] Example 1. Returning
function onPlayerCommand( player, cmd, text ) { if ( cmd == "getangle" ) { local ang = p_SpawnClass.Angle; MessagePlayer( "The spawning angle of this class is: " + ang, player ); } }
This example will return the spawning angle of the spawn class that we found earlier in FindSpawnClass.
[edit] Example 2. Setting
function onPlayerCommand( player, cmd, text ) { if ( cmd == "setangle" ) { if ( text ) p_SpawnClass.Angle = text.tofloat(); } }
This example will set the spawning angle of the spawn class that we found earlier in FindSpawnClass to the angle specified in the text parameter.
[edit] Notes
The call onPlayerCommand was used in in this example. More info about this in the corresponding page.