- So I have been working on a gamemode that needs a spectator mode. I have it all down. When you type “spectate” in console, you join the team spectator and you become invisible and spectate a player. When you type “respawn” in console, you respawn as a normal player with all the normal things a player has. My problem here is that I can’t get it so that when you click your Right Mouse button, it takes you to the next player in spectate mode. Here is the spectate code I have so far:
function spectate() local ply = LocalPlayer() ply:Spectate(4) ply:SetTeam(2) ply:SetModel("") ply:StripWeapon("weapon_fists") if (ply:KeyDown(IN_ATTACK2)) then ply:UnSpectate() ply:Spectate(4) end end concommand.Add( "spectate", spectate ) function respawn(ply) ply:UnSpectate() ply:SetTeam(1) ply:Give("weapon_fists") ply:SetModel("models/player/kleiner.mdl") end concommand.Add( "respawn", respawn )
- I also am looking to see how to get the players name to display when you are spectating them. I tried doing:
if ply:Spectate() then draw.DrawText( ply:Nick(), "Trebuchet24", ScrW()*.50, ScrH()*.81, Color( 0, 255, 0, 255), TEXT_ALIGN_CENTER ) end
But it’s only displaying your nickname and not the person who you are spectating.
Any help is appreciated