register_event("HLTV", "nr", "a", "1=0", "2=0") //Fired at new round, before freeze-time start
register_logevent("nr",2,"1=Round_Start") //Fired at the end of freeze time (your current code)
I'd personally go with get_players() because it does the work for you with less code/native calls.
There is theoretically nothing wrong with the code and I know it isn't going to make someones CPU blow smoke, there's just a few things can be improved to be more ideal.
- get_maxplayers() will be called 32 times per execution; at a minimum, the get_maxplayers() value should be stored in a variable instead of being placed within the for-loop condition block.
- The loop will iterate max_players/32 times, every time, instead of only a handful of times for those in spectator.
for(new i = 1; i <= get_maxplayers();i++)
if(is_user_connected(i) && cs_get_user_team(i) == CS_TEAM_SPECTATOR)
new iPlayers[ 32 ] , iNum;
get_players( iPlayers , iNum , "e" , "SPECTATOR" );
for ( new i = 0 ; i < iNum ; i++ )