• Issue with joining of spectating team at game start
    3 replies, posted
When trying to get players to join the spectator team it never really works. I tried this in the init.lua ---------------------------------------------- function joinspectators ( ply ) ply:StripWeapons( ) ply:StripAmmo( ) ply:SetTeam( 3 ) ply:Spectate( OBS_MODE_ROAMING ) ply:PrintMessage( HUD_PRINTTALK, "[DEV]Joining Spectators, " .. ply:Nick() ) end ---------------------------------------- This function never works when used inGM:PlayerInitialSpawn( ply ), but if I manually call it by lets say a console command the player will properly be placed on teh spectators. But it would be nice to have players be instantly assigned to the spectators when joining the game.
//Bump, Anyone know how to fix this?
Is this a team based game? If so you can set the team to be TEAM_SPECTATOR and that usually works for me personally. It's a pre-existing enumeration.
PlayerInitialSpawn is not the right hook to use these commands in, since it is in fact called before the player entity is ingame or at least too early for this. You want to use the PlayerSpawn hook and manually check if it's the first time.
Sorry, you need to Log In to post a reply to this thread.