mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
added command to move all players to a team. Closes #384
This commit is contained in:
parent
73010e7d2e
commit
1306b62ce2
|
@ -192,6 +192,7 @@ void CGameClient::OnConsoleInit()
|
|||
Console()->Register("broadcast", "r", CFGFLAG_SERVER, 0, 0, "Broadcast message");
|
||||
Console()->Register("say", "r", CFGFLAG_SERVER, 0, 0, "Say in chat");
|
||||
Console()->Register("set_team", "ii", CFGFLAG_SERVER, 0, 0, "Set team of player to team");
|
||||
Console()->Register("set_team_all", "i", CFGFLAG_SERVER, 0, 0, "Set team of all players to team");
|
||||
Console()->Register("addvote", "r", CFGFLAG_SERVER, 0, 0, "Add a voting option");
|
||||
Console()->Register("vote", "r", CFGFLAG_SERVER, 0, 0, "Force a vote to yes/no");
|
||||
|
||||
|
|
|
@ -904,6 +904,22 @@ void CGameContext::ConSetTeam(IConsole::IResult *pResult, void *pUserData)
|
|||
(void)pSelf->m_pController->CheckTeamBalance();
|
||||
}
|
||||
|
||||
void CGameContext::ConSetTeamAll(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
int Team = clamp(pResult->GetInteger(0), -1, 1);
|
||||
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "moved all clients to team %d", Team);
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
|
||||
|
||||
for(int i = 0; i < MAX_CLIENTS; ++i)
|
||||
if(pSelf->m_apPlayers[i])
|
||||
pSelf->m_apPlayers[i]->SetTeam(Team);
|
||||
|
||||
(void)pSelf->m_pController->CheckTeamBalance();
|
||||
}
|
||||
|
||||
void CGameContext::ConAddVote(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
|
@ -992,6 +1008,7 @@ void CGameContext::OnConsoleInit()
|
|||
Console()->Register("broadcast", "r", CFGFLAG_SERVER, ConBroadcast, this, "");
|
||||
Console()->Register("say", "r", CFGFLAG_SERVER, ConSay, this, "");
|
||||
Console()->Register("set_team", "ii", CFGFLAG_SERVER, ConSetTeam, this, "");
|
||||
Console()->Register("set_team_all", "i", CFGFLAG_SERVER, ConSetTeamAll, this, "");
|
||||
|
||||
Console()->Register("addvote", "r", CFGFLAG_SERVER, ConAddVote, this, "");
|
||||
Console()->Register("vote", "r", CFGFLAG_SERVER, ConVote, this, "");
|
||||
|
|
|
@ -52,6 +52,7 @@ class CGameContext : public IGameServer
|
|||
static void ConBroadcast(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConSay(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConSetTeam(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConSetTeamAll(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConAddVote(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConVote(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConchainSpecialMotdupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||
|
|
Loading…
Reference in a new issue