Make sv_join_vote_delay work for /map votes and make the number of seconds configurable

This commit is contained in:
def 2016-05-20 20:05:47 +02:00
parent aff85462aa
commit 3c54f443b2
4 changed files with 9 additions and 7 deletions

View file

@ -1166,7 +1166,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
return;
}
if(g_Config.m_SvJoinVoteDelay && Now < pPlayer->m_FirstVoteTick)
if(Now < pPlayer->m_FirstVoteTick)
{
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "You must wait %d seconds before making your first vote", ((pPlayer->m_FirstVoteTick - Now) / TickSpeed) + 1);

View file

@ -134,13 +134,9 @@ void CPlayer::Reset()
//
// Otherwise, block voting for 60 seconds after joining.
if(Now > GameServer()->m_NonEmptySince + 10 * TickSpeed)
{
m_FirstVoteTick = Now + 60 * TickSpeed;
}
m_FirstVoteTick = Now + g_Config.m_SvJoinVoteDelay * TickSpeed;
else
{
m_FirstVoteTick = Now;
}
}
void CPlayer::Tick()

View file

@ -506,6 +506,12 @@ void CSqlScore::MapVoteThread(void *pUser)
str_format(aBuf, sizeof(aBuf), "No map like \"%s\" found. Try adding a '%%' at the start if you don't know the first character. Example: /map %%castle for \"Out of Castle\"", originalMap);
pData->m_pSqlData->GameServer()->SendChatTarget(pData->m_ClientID, aBuf);
}
else if(Now < pPlayer->m_FirstVoteTick)
{
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "You must wait %d seconds before making your first vote", ((pPlayer->m_FirstVoteTick - Now) / pData->m_pSqlData->Server()->TickSpeed()) + 1);
pData->m_pSqlData->GameServer()->SendChatTarget(pData->m_ClientID, aBuf);
}
else if(pPlayer->m_LastVoteCall && Timeleft > 0)
{
char aChatmsg[512] = {0};

View file

@ -149,7 +149,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, 1, 0, 1, CFGFLAG_SERVER, "Add a delay before recently joined players can vote")
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(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");