View Single Post
Tibaus
Junior Member
Join Date: Apr 2020
Old 06-01-2020 , 23:30   Re: CSGO - Move all players to spec
Reply With Quote #3

Quote:
Originally Posted by mrtn View Post
To move all players to spectator is as simple as iterating client Ids, checking if they are in the game and not spectating, and moving to spectator with ChangeClientTeam() (CS_SwitchTeam() can only switch a client to CT or T):

PHP Code:
for (int clientId 1clientId <= MaxClientsclientId++) {
    if (
IsClientInGame(clientId) && !IsClientObserver(clientId)) {
        
ChangeClientTeam(clientIdCS_TEAM_SPECTATOR);
    }


mrtn, Thanks! That Works


Now I need to move a specific player, how can I do that? First I need to show each player in the menu and when one player is selected, move to CT or TR.

Thanks!
Tibaus is offline