[lua]
function GM:PlayerDeath( pl, wep, killer )
if pl:Team() != 4 then
pl:SetTeam(4)
end
pl.specid = 1
pl.Specatemode = OBS_MODE_CHASE
end
function GM:PlayerDeathThink(pl)
local Owner = team.GetPlayers(1)
local Admin = team.GetPlayers(2)
local Three = team.GetPlayers(3)
table.Add(Three, Owner)
table.Add(Three, Admin)
players = table.Copy(Three)
if TimerStatus == 1 or TimerStatus == 2 then
pl:UnSpectate()
pl:Spawn()
else
if pl:KeyPressed( IN_JUMP ) then
if pl.Specatemode == OBS_MODE_CHASE then
pl.Specatemode = OBS_MODE_IN_EYE
pl:UnSpectate()
pl:Spectate(pl.Specatemode)
pl:SpectateEntity( players[pl.specid] )
elseif pl.Specatemode == OBS_MODE_IN_EYE then
pl.Specatemode = OBS_MODE_CHASE
pl:UnSpectate()
pl:Spectate(pl.Specatemode)
pl:SpectateEntity( players[pl.specid] )
end
elseif pl:KeyPressed( IN_ATTACK ) then
if !pl.specid then
pl.specid = 1
end
pl.specid = pl.specid + 1
if pl.specid > #players then
pl.specid = 1
end
pl:UnSpectate()
pl:Spectate(pl.Specatemode)
pl:SpectateEntity( players[pl.specid] )
elseif pl:KeyPressed( IN_ATTACK2 ) then
if !pl.specid then
pl.specid = 1
end
pl.specid = pl.specid - 1
if pl.specid <= 0 then
pl.specid = #players
end
pl:UnSpectate()
pl:Spectate(pl.Specatemode)
pl:SpectateEntity( players[pl.specid] )
end
end
end
[/lua]
I copied this part from another gamemode. Why doesn't it change to other player when pressing Mouse1 or Mouse2?
You need to set .SpectateMode on the player first.
Before you run that huge if block, add: if !pl.SpectateMode then pl.SpectateMode = OBS_MODE_CHASE end
EDIT:
Also, this code calls for a table of players called 'players', which you should regularly empty out and fill up with all living players.
[QUOTE=DeltaPhantom;40293897]You need to set .SpectateMode on the player first.
Before you run that huge if block, add: if !pl.SpectateMode then pl.SpectateMode = OBS_MODE_CHASE end
EDIT:
Also, this code calls for a table of players called 'players', which you should regularly empty out and fill up with all living players.[/QUOTE]
I edited the code, it still doesn't work. Help plz.
[editline]16th April 2013[/editline]
Also I edited the code in the first post.
What's happening? Does it do anything?
Nothing happens when I press Mouse1 or Mouse2. Space works to change the spectate mode, but you can't change the player you are spectating with Mouse1 or Mouse2.
I really need help on this.
Rawr, definitely not a bump.
Sorry, you need to Log In to post a reply to this thread.