mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #2049
2049: Allow filtering by name in status r=def- a=12pm Easier to find players when the server is full Co-authored-by: 12pm <30786226+12pm@users.noreply.github.com>
This commit is contained in:
commit
2fc883f091
|
@ -3749,7 +3749,7 @@ void CClient::RegisterCommands()
|
||||||
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("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", "s[ip]", CFGFLAG_SERVER, 0, 0, "Unban ip");
|
m_pConsole->Register("unban", "s[ip]", CFGFLAG_SERVER, 0, 0, "Unban ip");
|
||||||
m_pConsole->Register("bans", "", CFGFLAG_SERVER, 0, 0, "Show banlist");
|
m_pConsole->Register("bans", "", CFGFLAG_SERVER, 0, 0, "Show banlist");
|
||||||
m_pConsole->Register("status", "", CFGFLAG_SERVER, 0, 0, "List players");
|
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("shutdown", "", CFGFLAG_SERVER, 0, 0, "Shut down");
|
||||||
m_pConsole->Register("record", "s[file]", CFGFLAG_SERVER, 0, 0, "Record to a file");
|
m_pConsole->Register("record", "s[file]", CFGFLAG_SERVER, 0, 0, "Record to a file");
|
||||||
m_pConsole->Register("stoprecord", "", CFGFLAG_SERVER, 0, 0, "Stop recording");
|
m_pConsole->Register("stoprecord", "", CFGFLAG_SERVER, 0, 0, "Stop recording");
|
||||||
|
|
|
@ -2275,12 +2275,16 @@ void CServer::ConStatus(IConsole::IResult *pResult, void *pUser)
|
||||||
char aBuf[1024];
|
char aBuf[1024];
|
||||||
char aAddrStr[NETADDR_MAXSTRSIZE];
|
char aAddrStr[NETADDR_MAXSTRSIZE];
|
||||||
CServer *pThis = static_cast<CServer *>(pUser);
|
CServer *pThis = static_cast<CServer *>(pUser);
|
||||||
|
const char *pName = pResult->NumArguments() == 1 ? pResult->GetString(0) : "";
|
||||||
|
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
{
|
{
|
||||||
if(pThis->m_aClients[i].m_State == CClient::STATE_EMPTY)
|
if(pThis->m_aClients[i].m_State == CClient::STATE_EMPTY)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if(!str_utf8_find_nocase(pThis->m_aClients[i].m_aName, pName))
|
||||||
|
continue;
|
||||||
|
|
||||||
net_addr_str(pThis->m_NetServer.ClientAddr(i), aAddrStr, sizeof(aAddrStr), true);
|
net_addr_str(pThis->m_NetServer.ClientAddr(i), aAddrStr, sizeof(aAddrStr), true);
|
||||||
if(pThis->m_aClients[i].m_State == CClient::STATE_INGAME)
|
if(pThis->m_aClients[i].m_State == CClient::STATE_INGAME)
|
||||||
{
|
{
|
||||||
|
@ -2972,7 +2976,7 @@ void CServer::RegisterCommands()
|
||||||
|
|
||||||
// register console commands
|
// register console commands
|
||||||
Console()->Register("kick", "i[id] ?r[reason]", CFGFLAG_SERVER, ConKick, this, "Kick player with specified id for any reason");
|
Console()->Register("kick", "i[id] ?r[reason]", CFGFLAG_SERVER, ConKick, this, "Kick player with specified id for any reason");
|
||||||
Console()->Register("status", "", CFGFLAG_SERVER, ConStatus, this, "List players");
|
Console()->Register("status", "?r[name]", CFGFLAG_SERVER, ConStatus, this, "List players containing name or all players");
|
||||||
Console()->Register("shutdown", "", CFGFLAG_SERVER, ConShutdown, this, "Shut down");
|
Console()->Register("shutdown", "", CFGFLAG_SERVER, ConShutdown, this, "Shut down");
|
||||||
Console()->Register("logout", "", CFGFLAG_SERVER, ConLogout, this, "Logout of rcon");
|
Console()->Register("logout", "", CFGFLAG_SERVER, ConLogout, this, "Logout of rcon");
|
||||||
Console()->Register("show_ips", "?i[show]", CFGFLAG_SERVER, ConShowIps, this, "Show IP addresses in rcon commands (1 = on, 0 = off)");
|
Console()->Register("show_ips", "?i[show]", CFGFLAG_SERVER, ConShowIps, this, "Show IP addresses in rcon commands (1 = on, 0 = off)");
|
||||||
|
|
Loading…
Reference in a new issue