Spectator Spawn-In System

Would It be possible for anyone to go out of their way and help produce a script that will allow players to spawn in through spectator mode? Something along the lines of the player pressing the mouse button while in spectator mode and he/she will spawn in at that position.

Not a very good idea, it would lead to people spawning in other people, people spawning in front of other people and killing them and then killing themselves.

Of course I will be doing more with it >.>
Could you please contribute instead of bash me?

Im not very good with lua but i guess it would consist of creating a info_player_start when they type a command or left/right click. After that i guess you would have to destroy the entity once the player has spawned through it.

Ok, but that doesnt tell me how I would go about doing it through spectating. Your method is easy but the hard part is trying to figure out how to switch from spectating to playing

OnDeath -> spectate -> pick spawn/spawn in -> Play (Unspectate) -> repeat

Not really, for you information an info_player_start entity is just what it says, information. It’s nothing more then a position where the game moves you after spawning you (it’s instant).

That being said you don’t need much more then that for your system.


function KeyPressed (L, key)
ply:StripWeapons()    
ply:Spectate( OBS_MODE_ROAMING )

end

function KeyPressed (P, key)
ply:UnSpectate()

end


???
I havn’t tested it but thought i should try and make it.

I got it to work fine. Apparently you cant call pl:Spectate(OBS_MODE_ROAMING) in GM:PlayerInitialSpawn so that was my problem. Thanks everyone!

what was the final piece of code you used?

[lua]
function GM:PlayerSpawn(pl)
if pl.NeedsToPickSpawn then
pl:Spectate(OBS_MODE_ROAMING)
return

elseif pl.HasChute then
    pl:SetModel(Model(models[math.random(#models)]))
    gamemode.Call( "PlayerLoadout", pl )
    
end

end

function ParachuteSpawn(ply)
SpawnPos = ply:GetPos()
SpawnPos.z = 3900
ply.HasChute = true
ply.NeedsToPickSpawn = false
ply:Spectate(OBS_MODE_NONE)
ply:Spawn()
ply:SetPos(SpawnPos)
DeployChute(ply)
end
[/lua]

Oh were you making a new parachute? I was going to make a skydiving gamemode that had a hud that showed velocity and i only finished a bit of it

Yes. Its for a gamemode I am finishing. It allows players to pick where they want to spawn in from.