for(i = 0; i < MAX_SPECTATORS; ++i)
spectatorlist[i] = 0; // reset list first
- for(i = 0; i < num_spectators; ++i)
+ int limit = min(num_spectators, MAX_SPECTATORS);
+ for(i = 0; i < limit; ++i)
{
slot = ReadByte();
spectatorlist[i] = slot - 1;
}
}
+ else
+ {
+ for(int j = 0; j < MAX_SPECTATORS; ++j)
+ spectatorlist[j] = 0; // reset list if showspectators has been turned off
+ num_spectators = 0;
+ }
return = true;
{
if(!player) { return; } // not sure how, but best to be safe
+ int spec_count = 0;
FOREACH_CLIENT(IS_REAL_CLIENT(it) && IS_SPEC(it) && it != to && it.enemy == player,
{
+ if(spec_count >= MAX_SPECTATORS)
+ break;
WriteByte(MSG_ENTITY, num_for_edict(it));
+ ++spec_count;
});
}
#define SPECTATE_COPYFIELD(fld) SPECTATE_COPY() { this.(fld) = spectatee.(fld); }
int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodcontrol);
+
+const int MAX_SPECTATORS = 7;