Lua Help With Spectate...

Hello. I am designing a gamemode and I just got stuck on a little part of it. When I make a player go into “Spectate Mode” using OBS_MODE_CHASE, which can follow a player in thirdperson, I want it so it disables me from spawning and also to be able to switch thirdperson views of multiple players and not just one. Your help is strongly appreciated :D.

I wonder if tracers could have some role in this…

Sorry mate, I can’t help you with your problem. Most of my focus on Lua has been general and not Gmod Embedded. I hope you find the solution to your problem, though.

I don’t know, but you could make a global variable, and then do something like this:

[lua]ourVariable = true

function DeathSpectate( ply )

ply:Spectate( OBS_MODE_CHASE )
ourVariable = false

end
hook.Add(“PlayerDeath”, “ourHook”, DeathSpectate)

function GM:PlayerSpawn( ply )

if ourVariable == false then
	
	return false
	
else
	
	return true

end

end
[/lua]

Untested, but to the best of my belief, I think it should work.

Thanks Lucky, that helped me out a lot with figuring it out.

That variable affects everybody. try writing to each players table with it or something.