Skip to content

Commit

Permalink
Improve sv_join_vote_delay against vote bots
Browse files Browse the repository at this point in the history
- Prolong to 5 minutes
- also affects participating in votes
  • Loading branch information
def- committed Dec 11, 2018
1 parent fabd559 commit b224a4d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/game/server/gamecontext.cpp
Expand Up @@ -726,6 +726,7 @@ void CGameContext::OnTick()
if(m_apPlayers[i])
Server()->GetClientAddr(i, aaBuf[i], NETADDR_MAXSTRSIZE);
bool aVoteChecked[MAX_CLIENTS] = {0};
int64 Now = Server()->Tick();
for(int i = 0; i < MAX_CLIENTS; i++)
{
//if(!m_apPlayers[i] || m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS || aVoteChecked[i]) // don't count in votes by spectators
Expand All @@ -743,6 +744,10 @@ void CGameContext::OnTick()
if(m_apPlayers[i]->m_Afk && i != m_VoteCreator)
continue;

// can't vote in the beginning after joining
if(Now < m_apPlayers[i]->m_FirstVoteTick)
continue;

// connecting clients with spoofed ips can clog slots without being ingame
if(((CServer*)Server())->m_aClients[i].m_State != CServer::CClient::STATE_INGAME)
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/game/server/player.cpp
Expand Up @@ -127,7 +127,7 @@ void CPlayer::Reset()
// non-empty, allow them to vote immediately. This allows players to
// vote after map changes or when they join an empty server.
//
// Otherwise, block voting for 60 seconds after joining.
// Otherwise, block voting in the begnning after joining.
if(Now > GameServer()->m_NonEmptySince + 10 * TickSpeed)
m_FirstVoteTick = Now + g_Config.m_SvJoinVoteDelay * TickSpeed;
else
Expand Down
2 changes: 1 addition & 1 deletion src/game/variables.h
Expand Up @@ -140,7 +140,7 @@ MACRO_CONFIG_INT(SvVoteSpectateRejoindelay, sv_vote_spectate_rejoindelay, 3, 0,
MACRO_CONFIG_INT(SvVoteKick, sv_vote_kick, 1, 0, 1, CFGFLAG_SERVER, "Allow voting to kick players")
MACRO_CONFIG_INT(SvVoteKickMin, sv_vote_kick_min, 0, 0, MAX_CLIENTS, CFGFLAG_SERVER, "Minimum number of players required to start a kick vote")
MACRO_CONFIG_INT(SvVoteKickBantime, sv_vote_kick_bantime, 5, 0, 1440, CFGFLAG_SERVER, "The time in seconds to ban a player if kicked by vote. 0 makes it just use kick")
MACRO_CONFIG_INT(SvJoinVoteDelay, sv_join_vote_delay, 60, 0, 1000, CFGFLAG_SERVER, "Add a delay before recently joined players can vote (in seconds)")
MACRO_CONFIG_INT(SvJoinVoteDelay, sv_join_vote_delay, 300, 0, 1000, CFGFLAG_SERVER, "Add a delay before recently joined players can call or participate in a vote (in seconds)")
MACRO_CONFIG_INT(SvOldTeleportWeapons, sv_old_teleport_weapons, 0, 0, 1, CFGFLAG_SERVER|CFGFLAG_GAME, "Teleporting of all weapons (deprecated, use special entities instead)")
MACRO_CONFIG_INT(SvOldTeleportHook, sv_old_teleport_hook, 0, 0, 1, CFGFLAG_SERVER|CFGFLAG_GAME, "Hook through teleporter (deprecated, use special entities instead)")
MACRO_CONFIG_INT(SvTeleportHoldHook, sv_teleport_hold_hook, 0, 0, 1, CFGFLAG_SERVER|CFGFLAG_GAME, "Hold hook when teleported")
Expand Down

0 comments on commit b224a4d

Please sign in to comment.