View Full Version : How do you give dead players spectator view until round restart?

07-31-2007, 09:44 PM
How do you give dead players spectator view until round restart?

08-01-2007, 12:39 AM
Wooooo counter-strike cloan action!

I'd look at the death function and add this in

StartObserverMode( OBS_MODE_ROAMING );

I'm not sure exactly what OBS_MODE_ROAMING is, I got this form the Spawn code in hl2mp_player.cpp.

Then assuming you have it setup to spawn the player only when the round restarts, the next time the player is spawned, he'll be put back to normal.

08-01-2007, 12:40 AM

// Spectator Movement modes
enum {
OBS_MODE_NONE = 0, // not in spectator mode
OBS_MODE_DEATHCAM, // special mode for detah cam animation
OBS_MODE_FIXED, // view from a fixed camera position
OBS_MODE_IN_EYE, // follow a player in first perosn view
OBS_MODE_CHASE, // follow a player in third person view
OBS_MODE_ROAMING, // free roaming

08-01-2007, 05:09 PM

but is that able to be called from lua?
i only have access to the lua scripting, but not the engine.

08-01-2007, 06:17 PM
I found this and put it in my lua:

Player:Spectate( OBS_MODE_ROAMING )

function spectate( ply, ent )
ply:Spectate( OBS_MODE_ROAMING )
ply:SpectateEntity( ent )

but when it's called, console gives this error:

Error calling player_killed (no static 'Spectate' in class 'Player') ent: NULL

player class

08-02-2007, 03:01 AM
What are you working with that only gives you access to the Lua? GMod?

08-02-2007, 04:16 AM
Yeah, that's gmod Lua.

Head on over to irc://irc.gamesurge.net/gmod or irc://irc.gamesurge.net/luahelp . They can help you more than we can.

08-02-2007, 09:23 PM
thank you

("the message you entered is too short..." god this is the clunkiest forum ever)