1. A few possibilities:
- map .cfg files (cfg/ff_dustbowl.cfg, cfg/ff_ksour.cfg, etc) that set sv_globalluascript and a server.cfg that resets it to blank or something else
- add an IncludeScript() line to the gametype's base include (base_ad, etc) that includes your file
- maybe more than I can't think of right now
2. Absolutely. This will count only players on a playable team (blue through green):
Code:
local numplayers = 0
for team_id = Team.kBlue, Team.kGreen do
numplayers += GetTeam( team_id ):GetNumPlayers()
end
Including spectators:
Code:
local numplayers = 0
for team_id = Team.kSpectator, Team.kGreen do
numplayers += GetTeam( team_id ):GetNumPlayers()
end
Including spectators and unassigned:
Code:
local numplayers = 0
for team_id = Team.kUnassigned, Team.kGreen do
numplayers += GetTeam( team_id ):GetNumPlayers()
end
EDIT: To react to changes in player number immediately, you can use the callback functions player_disconnected( player ) and player_switchteam( player, old_team_id, new_team_id )