I'm working on a script to promote spectators automatically to shoutcaster status. The idea is when a client connects, they instantly become a shoutcaster, thus enjoying the additional features that SC allows in comparison to a spectator. I'm now doubting whether this is actually possible, but I'll explain what I was thinking.
So here is the code:
function et_ClientConnect( clientNum, firstTime, isBot) local connect = et.gentity_get(clientNum, "pers.connected") if connect == 2 then return end local team = et.gentity_get(clientNum, "sess.sessionTeam") if isBot(clientNum) then return end if team == 3 then et.trap_SendConsoleCommand( et.EXEC_APPEND, "makesc "..clientNum.."\n") return end if isBot(clientNum) then return end if team == "" then et.trap_SendConsoleCommand( et.EXEC_APPEND, "removesc "..clientNum.."\n") return end function isBot(clientNum) if et.gentity_get(clientNum,"ps.ping") == 0 then return true endend
The script works as in it detects when a client is connected, and makes them a shoutcaster, however this doesn't happen if they have to reconnect to download a map for example.
The main issue: I can't log them out of SC so that they can join a team. I originally was going to use "removesc" to take away their elevated status once they joined either b/r. However, they can't actually join a team so it's pointless trying to look for when they join a team. Is there a way to log them out as they are choosing a team (ie - limbo, looking for a /team cvar etc) or is this just impossible currently.
If so, an idea I would like to request is Shoutcaster automatically logging the client out when they join a team. They log in, it is normal in spec but once a team is chosen they are logged out and have a normal status as per usual. Thanks for reading.