Merge pull request #753 from Learath2/dd_pr_voting

Fix vote spam
This commit is contained in:
Dennis Felsing 2017-05-14 11:49:12 +02:00 committed by GitHub
commit 610195f21e
4 changed files with 29 additions and 8 deletions

View file

@ -40,6 +40,7 @@ CONSOLE_COMMAND("showothers", "?i['0'|'1']", CFGFLAG_CHAT, ConShowOthers, this,
CONSOLE_COMMAND("showall", "?i['0'|'1']", CFGFLAG_CHAT, ConShowAll, this, "Whether to show players at any distance (off by default), optional i = 0 for off else for on")
CONSOLE_COMMAND("list", "?s[filter]", CFGFLAG_CHAT, ConList, this, "List connected players with optional case-insensitive substring matching filter")
CONSOLE_COMMAND("set_team_ddr", "v[id]", CFGFLAG_SERVER, ConSetDDRTeam, this, "Set ddrace team of a player")
CONSOLE_COMMAND("mute", "", CFGFLAG_SERVER, ConMute, this, "");
CONSOLE_COMMAND("muteid", "v[id] i[seconds]", CFGFLAG_SERVER, ConMuteID, this, "");

View file

@ -477,6 +477,21 @@ void CGameContext::ConList(IConsole::IResult *pResult, void *pUserData)
pSelf->List(ClientID, &zerochar);
}
void CGameContext::ConSetDDRTeam(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *)pUserData;
CGameControllerDDRace *pController = (CGameControllerDDRace *)pSelf->m_pController;
int Target = pResult->GetVictim();
int Team = pResult->GetInteger(0);
if(pController->m_Teams.m_Core.Team(Target) && pController->m_Teams.GetDDRaceState(pSelf->m_apPlayers[Target]) == DDRACE_STARTED)
pSelf->m_apPlayers[Target]->KillCharacter(WEAPON_SELF);
pController->m_Teams.SetForceCharacterTeam(pResult->GetVictim(), Team);
}
void CGameContext::ConFreezeHammer(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *) pUserData;

View file

@ -719,9 +719,6 @@ void CGameContext::OnTick()
Server()->SetRconCID(IServer::RCON_CID_SERV);
EndVote();
SendChat(-1, CGameContext::CHAT_ALL, "Vote passed");
if(m_apPlayers[m_VoteCreator])
m_apPlayers[m_VoteCreator]->m_LastVoteCall = 0;
}
else if(m_VoteEnforce == VOTE_ENFORCE_YES_ADMIN)
{
@ -1405,13 +1402,20 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
str_format(aChatmsg, sizeof(aChatmsg), "'%s' called for vote to kick '%s' (%s)", Server()->ClientName(ClientID), Server()->ClientName(KickID), aReason);
str_format(aDesc, sizeof(aDesc), "Kick '%s'", Server()->ClientName(KickID));
if (!g_Config.m_SvVoteKickBantime)
str_format(aCmd, sizeof(aCmd), "kick %d Kicked by vote", KickID);
if(!GetDDRaceTeam(ClientID))
{
if (!g_Config.m_SvVoteKickBantime)
str_format(aCmd, sizeof(aCmd), "kick %d Kicked by vote", KickID);
else
{
char aAddrStr[NETADDR_MAXSTRSIZE] = {0};
Server()->GetClientAddr(KickID, aAddrStr, sizeof(aAddrStr));
str_format(aCmd, sizeof(aCmd), "ban %s %d Banned by vote", aAddrStr, g_Config.m_SvVoteKickBantime);
}
}
else
{
char aAddrStr[NETADDR_MAXSTRSIZE] = {0};
Server()->GetClientAddr(KickID, aAddrStr, sizeof(aAddrStr));
str_format(aCmd, sizeof(aCmd), "ban %s %d Banned by vote", aAddrStr, g_Config.m_SvVoteKickBantime);
str_format(aCmd, sizeof(aCmd), "set_team_ddr %d 0", KickID);
}
m_apPlayers[ClientID]->m_Last_KickVote = time_get();
m_VoteKick = true;

View file

@ -325,6 +325,7 @@ private:
static void ConMutes(IConsole::IResult *pResult, void *pUserData);
static void ConList(IConsole::IResult *pResult, void *pUserData);
static void ConSetDDRTeam(IConsole::IResult *pResult, void *pUserData);
static void ConFreezeHammer(IConsole::IResult *pResult, void *pUserData);
static void ConUnFreezeHammer(IConsole::IResult *pResult, void *pUserData);