Player.Spectate
From GMod Wiki
Function | |
Syntax | Player:Spectate( Enum ) |
Description: | |
Places player in spectator mode. | |
Returns: | Enum |
In Object: | Player |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Player.Spectate]Player.Spectate [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
Description | This will make the player spectate the entity passed to the function. |
---|---|
Used on | |
Code | function Spectate( ply, ent ) ply:Spectate( OBS_MODE_CHASE ) ply:SpectateEntity( ent ) end |
Output | N/A |
Arguments
- Return values:
SHARED | 0000000000000000 | 00000000000000000 | OBS_MODE_NONE -- Not in spectator mode. SHARED | 0000000000000001 | 00000000000000001 | OBS_MODE_DEATHCAM -- Special mode for death cam animation. SHARED | 0000000000000002 | 00000000000000010 | OBS_MODE_FREEZECAM -- View is frozen to a specific frame. SHARED | 0000000000000003 | 00000000000000011 | OBS_MODE_FIXED -- View from a fixed camera position. SHARED | 0000000000000004 | 00000000000000100 | OBS_MODE_IN_EYE -- Follow a player in first person view. SHARED | 0000000000000005 | 00000000000000101 | OBS_MODE_CHASE -- Follow an entity in third person view. SHARED | 0000000000000006 | 00000000000000110 | OBS_MODE_ROAMING -- Free roaming (glorified noclip).
Additional Notes
- If you are spectating an entity and it moves outside the PVS you were in when you began spectating it, it will disappear. Whenever spectating an entity, be sure to set the player's movetype to MOVETYPE_OBSERVER.
- Make sure to strip the player's weapons before spectating, or they will be visible while in spectate.
See Also
This page needs reviewing. An expert needs to verify that all of the information in this page is correct. See more articles for review here. |