Print reason kick also added reason message for kick

This commit is contained in:
s1lent 2019-06-21 02:37:44 +07:00
parent 0ad1232786
commit 9ed19456f0
5 changed files with 50 additions and 10 deletions

View File

@ -900,14 +900,21 @@ void CCSBotManager::MaintainBotQuota()
} }
// attempt to kick a bot from the given team // attempt to kick a bot from the given team
if (UTIL_KickBotFromTeam(kickTeam)) bool atLeastOneKicked = UTIL_KickBotFromTeam(kickTeam);
return;
// if there were no bots on the team, kick a bot from the other team if (!atLeastOneKicked)
if (kickTeam == TERRORIST) {
UTIL_KickBotFromTeam(CT); // if there were no bots on the team, kick a bot from the other team
else if (kickTeam == TERRORIST)
UTIL_KickBotFromTeam(TERRORIST); atLeastOneKicked = UTIL_KickBotFromTeam(CT);
else
atLeastOneKicked = UTIL_KickBotFromTeam(TERRORIST);
}
if (atLeastOneKicked)
{
CONSOLE_ECHO("These bots kicked to maintain quota.\n");
}
} }
else else
{ {

View File

@ -563,8 +563,16 @@ void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer)
if (iVotesNeeded >= int(fKickPercent)) if (iVotesNeeded >= int(fKickPercent))
{ {
#ifdef REGAMEDLL_FIXES
SERVER_COMMAND(UTIL_VarArgs("kick #%d \"You have been voted off.\"\n", iVoteID));
SERVER_EXECUTE();
#endif
UTIL_ClientPrintAll(HUD_PRINTCENTER, "#Game_kicked", STRING(pKickPlayer->pev->netname)); UTIL_ClientPrintAll(HUD_PRINTCENTER, "#Game_kicked", STRING(pKickPlayer->pev->netname));
#ifndef REGAMEDLL_FIXES
SERVER_COMMAND(UTIL_VarArgs("kick # %d\n", iVoteID)); SERVER_COMMAND(UTIL_VarArgs("kick # %d\n", iVoteID));
#endif
pTempEntity = nullptr; pTempEntity = nullptr;
while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player"))) while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player")))
@ -1767,17 +1775,26 @@ BOOL EXT_FUNC __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *pPlayer, int slot)
{ {
team = (RANDOM_LONG(0, 1) == 0) ? TERRORIST : CT; team = (RANDOM_LONG(0, 1) == 0) ? TERRORIST : CT;
if (!UTIL_KickBotFromTeam(team)) bool atLeastOneLeft = UTIL_KickBotFromTeam(team);
if (!atLeastOneLeft)
{ {
// no bots on that team, try the other // no bots on that team, try the other
team = (team == CT) ? TERRORIST : CT; team = (team == CT) ? TERRORIST : CT;
if (!UTIL_KickBotFromTeam(team)) atLeastOneLeft = UTIL_KickBotFromTeam(team);
if (!atLeastOneLeft)
{ {
// couldn't kick any bots, fail // couldn't kick any bots, fail
team = UNASSIGNED; team = UNASSIGNED;
} }
} }
if (atLeastOneLeft)
{
CONSOLE_ECHO("These bots has left the game to make room for human players.\n");
}
} }
} }
@ -1905,7 +1922,10 @@ BOOL EXT_FUNC __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *pPlayer, int slot)
if (cv_bot_auto_vacate.value > 0 && !pPlayer->IsBot()) if (cv_bot_auto_vacate.value > 0 && !pPlayer->IsBot())
{ {
if (UTIL_KickBotFromTeam(team)) if (UTIL_KickBotFromTeam(team))
{
CONSOLE_ECHO("These bots has left the game to make room for human players.\n");
madeRoom = true; madeRoom = true;
}
} }
if (!madeRoom) if (!madeRoom)

View File

@ -854,7 +854,7 @@ void CHostage::ApplyHostagePenalty(CBasePlayer *pAttacker)
else if (pAttacker->m_iHostagesKilled >= iHostagePenalty) else if (pAttacker->m_iHostagesKilled >= iHostagePenalty)
{ {
#ifdef REGAMEDLL_FIXES #ifdef REGAMEDLL_FIXES
SERVER_COMMAND(UTIL_VarArgs("kick #%d\n", GETPLAYERUSERID(pAttacker->edict()))); SERVER_COMMAND(UTIL_VarArgs("kick #%d \"For killing too many hostages\"\n", GETPLAYERUSERID(pAttacker->edict())));
#else #else
CLIENT_COMMAND(pAttacker->edict(), "disconnect\n"); CLIENT_COMMAND(pAttacker->edict(), "disconnect\n");
#endif #endif

View File

@ -3806,7 +3806,11 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(PlayerKilled)(CBasePlayer *pVictim,
int iUserID = GETPLAYERUSERID(killer->edict()); int iUserID = GETPLAYERUSERID(killer->edict());
if (iUserID != -1) if (iUserID != -1)
{ {
#ifdef REGAMEDLL_FIXES
SERVER_COMMAND(UTIL_VarArgs("kick #%d \"For killing too many teammates\"\n", iUserID));
#else
SERVER_COMMAND(UTIL_VarArgs("kick # %d\n", iUserID)); SERVER_COMMAND(UTIL_VarArgs("kick # %d\n", iUserID));
#endif
} }
} }

View File

@ -4244,7 +4244,16 @@ void EXT_FUNC CBasePlayer::__API_HOOK(PreThink)()
UTIL_LogPrintf("\"%s<%i><%s><%s>\" triggered \"Game_idle_kick\" (auto)\n", STRING(pev->netname), GETPLAYERUSERID(edict()), GETPLAYERAUTHID(edict()), GetTeam(m_iTeam)); UTIL_LogPrintf("\"%s<%i><%s><%s>\" triggered \"Game_idle_kick\" (auto)\n", STRING(pev->netname), GETPLAYERUSERID(edict()), GETPLAYERAUTHID(edict()), GetTeam(m_iTeam));
UTIL_ClientPrintAll(HUD_PRINTCONSOLE, "#Game_idle_kick", STRING(pev->netname)); UTIL_ClientPrintAll(HUD_PRINTCONSOLE, "#Game_idle_kick", STRING(pev->netname));
#ifdef REGAMEDLL_FIXES
int iUserID = GETPLAYERUSERID(edict());
if (iUserID != -1)
{
SERVER_COMMAND(UTIL_VarArgs("kick #%d \"Player idle\"\n", iUserID));
}
#else
SERVER_COMMAND(UTIL_VarArgs("kick \"%s\"\n", STRING(pev->netname))); SERVER_COMMAND(UTIL_VarArgs("kick \"%s\"\n", STRING(pev->netname)));
#endif // #ifdef REGAMEDLL_FIXES
m_fLastMovement = gpGlobals->time; m_fLastMovement = gpGlobals->time;
} }
} }