Skip to content

Commit

Permalink
Add disconnect reason strings
Browse files Browse the repository at this point in the history
They don't show up to clients but better have them than not, also fixes a crash
  • Loading branch information
xen-000 committed Jan 17, 2025
1 parent ccfa67e commit 303422b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/adminsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ CON_COMMAND_CHAT_FLAGS(kick, "<name> - Kick a player", ADMFLAG_KICK)
CCSPlayerController* pTarget = CCSPlayerController::FromSlot(pSlots[i]);
ZEPlayer* pTargetPlayer = pTarget->GetZEPlayer();

g_pEngineServer2->DisconnectClient(pTargetPlayer->GetPlayerSlot(), NETWORK_DISCONNECT_KICKED);
g_pEngineServer2->DisconnectClient(pTargetPlayer->GetPlayerSlot(), NETWORK_DISCONNECT_KICKED, "Kicked by an admin");

if (iNumClients == 1)
PrintSingleAdminAction(pszCommandPlayerName, pTarget->GetPlayerName(), "kicked");
Expand Down Expand Up @@ -1406,7 +1406,7 @@ void CAdminSystem::ShowDisconnectedPlayers(CCSPlayerController* const pAdmin)

void CBanInfraction::ApplyInfraction(ZEPlayer* player)
{
g_pEngineServer2->DisconnectClient(player->GetPlayerSlot(), NETWORK_DISCONNECT_KICKBANADDED); // "Kicked and banned"
g_pEngineServer2->DisconnectClient(player->GetPlayerSlot(), NETWORK_DISCONNECT_KICKBANADDED, "Banned by an admin"); // "Kicked and banned"
}

void CMuteInfraction::ApplyInfraction(ZEPlayer* player)
Expand Down
2 changes: 1 addition & 1 deletion src/idlemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void CIdleSystem::CheckForIdleClients()
if (iClientNum < g_iMinClientsForIdleKicks)
continue;

g_pEngineServer2->DisconnectClient(zPlayer->GetPlayerSlot(), NETWORK_DISCONNECT_KICKED_IDLE);
g_pEngineServer2->DisconnectClient(zPlayer->GetPlayerSlot(), NETWORK_DISCONNECT_KICKED_IDLE, "Auto kicked for being idle");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/playermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ void CPlayerManager::OnValidateAuthTicket(ValidateAuthTicketResponse_t* pRespons
if (!hPlayer.IsValid())
return -1.f;

g_pEngineServer2->DisconnectClient(hPlayer.GetPlayerSlot(), NETWORK_DISCONNECT_KICKED_NOSTEAMLOGIN);
g_pEngineServer2->DisconnectClient(hPlayer.GetPlayerSlot(), NETWORK_DISCONNECT_KICKED_NOSTEAMLOGIN, "Auto kicked for failed steam authentication");
return -1.f;
});
}
Expand Down

0 comments on commit 303422b

Please sign in to comment.