When I make a player un-spectate an entity, the player has no model and invisible. The vguis are also gone. Anybody have an answer?
Here's all of the info you need to make a spectate system: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/spectating_players_system.lua[/url]
It's set-up in a way that when a player first joins the game, they're set as spectator. It adds 2 helper functions: Player:Unassigned( ) and Player:CanRespawn( ) - these aren't needed, but help.
The main thing to learn from this is when you spawn a player, if they're allowed to spawn call Player:UnSpectate( ); - The TEAM should be changed from TEAM_SPECTATOR, the game-mode should do this somewhere. Otherwise they won't be able to spawn. Additionally, you want to manage the PlayerDeath / PlayerDeathThink and PlayerSelectSpawn hooks if they're spectating. You don't want any of those to continue if they're spectator / ing
[QUOTE=Acecool;44370533]Here's all of the info you need to make a spectate system: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/spectating_players_system.lua[/url]
It's set-up in a way that when a player first joins the game, they're set as spectator. It adds 2 helper functions: Player:Unassigned( ) and Player:CanRespawn( ) - these aren't needed, but help.
The main thing to learn from this is when you spawn a player, if they're allowed to spawn call Player:UnSpectate( ); - The TEAM should be changed from TEAM_SPECTATOR, the game-mode should do this somewhere. Otherwise they won't be able to spawn. Additionally, you want to manage the PlayerDeath / PlayerDeathThink and PlayerSelectSpawn hooks if they're spectating. You don't want any of those to continue if they're spectator / ing[/QUOTE] What I want to do is have a player, still assigned to their team, spectate, and unspectate something at will. The person can't die.
If I recall correctly, UnSpectate / Spectate will "kill" the player. At least one system I've seen did that without calling kill on the player... I'll play around with it a little bit to see what happens under certain scenarios, you should too :-)
On thing you may need to look into if it does kill the player, is try rendering a camera on your screen, which needs to PVS to be updated to include the position where you're spectating.
Sorry, you need to Log In to post a reply to this thread.