I want to have it so when a player dies, he's forced to spectate.
This works but when they click or press a button they respawn stripped of weapons but with the team they died on model. Basically if you die as a Terrorist you spectate but when you click you respawn, not spectating, with no weapons, but have the terrorist model.
My spawn function:
[CODE]function GM:PlayerSpawn( ply )
if ply:Team() == 2 then
ply:SetModel("models/player/t_leet.mdl")
ply:Give("m9k_ak47")
ply:Give("m9k_ragingbull")
ply:SetHealth( 10 )
elseif ply:Team() == 3 then
ply:SetModel("models/player/ct_sas.mdl")
ply:Give("m9k_acr")
ply:Give("m9k_m92beretta")
ply:SetHealth( 10 )
elseif ply:Team() == 1 then
GAMEMODE:PlayerSpawnAsSpectator( ply )
end
end[/CODE]
My death function:
[CODE]function GM:PlayerDeath( victim, inflictor, killer )
RunConsoleCommand( "Spectators" )
end[/CODE]
That command:
[CODE] function Spectators( ply )
ply:SetTeam( 1 ) //Make the player join team 1
GAMEMODE:PlayerSpawnAsSpectator( ply )
end [/CODE]
And the command its self:
[CODE]concommand.Add( "Spectators", Spectators ) //Add the command to set the players team to team 1 [/CODE]
After messing around din multpilayer I realized if anyone dies it brought me, the host, to spectate. There have also been many other bugs if I am the host. ALSO animations for walking getting super glitchy IN MULTIPLAYER . Oh and another thing there are no sounds unless you are the host ( There are sounds but the guns (Which are SWEPs) don't have sound even though I have the files ) .
So I've come to the conclusion my code is fucked and I need help.
Bump also having issues with spectator
[U]Edit :[/U] I just want the the player go to team spectator when he is dead , and that they have OBS_MODE_ROAMING .
Now i have this at serverside :
[CODE]function GM:PlayerDeath( ply, inflictor, attacker )
ply:SetTeam( TEAM_SPECTATOR )
end
function Spectator( ply )
ply:StripWeapons();
if ( ply:Team() == TEAM_UNASSIGNED ) then
ply:Spectate( OBS_MODE_FIXED )
return
end
ply:SetTeam( TEAM_SPECTATOR )
ply:Spectate( OBS_MODE_ROAMING )
end[/CODE]
Sorry, you need to Log In to post a reply to this thread.