diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 727c0c336..66918b9a3 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -4241,7 +4241,7 @@ void CClient::RegisterCommands() m_pConsole->Register("kick", "i[id] ?r[reason]", CFGFLAG_SERVER, 0, 0, "Kick player with specified id for any reason"); m_pConsole->Register("ban", "s[ip|id] ?i[minutes] r[reason]", CFGFLAG_SERVER, 0, 0, "Ban player with ip/id for x minutes for any reason"); m_pConsole->Register("unban", "r[ip]", CFGFLAG_SERVER, 0, 0, "Unban ip"); - m_pConsole->Register("bans", "", CFGFLAG_SERVER, 0, 0, "Show banlist"); + m_pConsole->Register("bans", "?i[page]", CFGFLAG_SERVER, 0, 0, "Show banlist (page 0 by default, 20 entries per page)"); m_pConsole->Register("status", "?r[name]", CFGFLAG_SERVER, 0, 0, "List players containing name or all players"); m_pConsole->Register("shutdown", "", CFGFLAG_SERVER, 0, 0, "Shut down"); m_pConsole->Register("record", "r[file]", CFGFLAG_SERVER, 0, 0, "Record to a file"); diff --git a/src/engine/shared/netban.cpp b/src/engine/shared/netban.cpp index fdf86a6d0..bdfc388ff 100644 --- a/src/engine/shared/netban.cpp +++ b/src/engine/shared/netban.cpp @@ -309,7 +309,7 @@ void CNetBan::Init(IConsole *pConsole, IStorage *pStorage) Console()->Register("unban", "s[ip|entry]", CFGFLAG_SERVER | CFGFLAG_MASTER | CFGFLAG_STORE, ConUnban, this, "Unban ip/banlist entry"); Console()->Register("unban_range", "s[first ip] s[last ip]", CFGFLAG_SERVER | CFGFLAG_MASTER | CFGFLAG_STORE, ConUnbanRange, this, "Unban ip range"); Console()->Register("unban_all", "", CFGFLAG_SERVER | CFGFLAG_MASTER | CFGFLAG_STORE, ConUnbanAll, this, "Unban all entries"); - Console()->Register("bans", "", CFGFLAG_SERVER | CFGFLAG_MASTER | CFGFLAG_STORE, ConBans, this, "Show banlist"); + Console()->Register("bans", "?i[page]", CFGFLAG_SERVER | CFGFLAG_MASTER, ConBans, this, "Show banlist (page 0 by default, 20 entries per page)"); Console()->Register("bans_save", "s[file]", CFGFLAG_SERVER | CFGFLAG_MASTER | CFGFLAG_STORE, ConBansSave, this, "Save banlist in a file"); } @@ -503,16 +503,28 @@ void CNetBan::ConBans(IConsole::IResult *pResult, void *pUser) { CNetBan *pThis = static_cast(pUser); + int Page = pResult->NumArguments() > 0 ? pResult->GetInteger(0) : 0; + static const int EntriesPerPage = 20; + int Count = 0; char aBuf[256], aMsg[256]; - for(CBanAddr *pBan = pThis->m_BanAddrPool.First(); pBan; pBan = pBan->m_pNext) + int i = 0; + for(CBanAddr *pBan = pThis->m_BanAddrPool.First(); pBan; pBan = pBan->m_pNext, i++) { + if(i < Page * EntriesPerPage || i >= (Page + 1) * EntriesPerPage) + { + continue; + } pThis->MakeBanInfo(pBan, aBuf, sizeof(aBuf), MSGTYPE_LIST); str_format(aMsg, sizeof(aMsg), "#%i %s", Count++, aBuf); pThis->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "net_ban", aMsg); } - for(CBanRange *pBan = pThis->m_BanRangePool.First(); pBan; pBan = pBan->m_pNext) + for(CBanRange *pBan = pThis->m_BanRangePool.First(); pBan; pBan = pBan->m_pNext, i++) { + if(i < Page * EntriesPerPage || i >= (Page + 1) * EntriesPerPage) + { + continue; + } pThis->MakeBanInfo(pBan, aBuf, sizeof(aBuf), MSGTYPE_LIST); str_format(aMsg, sizeof(aMsg), "#%i %s", Count++, aBuf); pThis->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "net_ban", aMsg);