mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 06:58:20 +00:00
add vote_no command and show auth rank in force vote
This commit is contained in:
parent
6bf4a6e2ee
commit
1e88ad92a0
|
@ -48,6 +48,7 @@ CONSOLE_COMMAND("muteip", "s[ip] i[seconds]", CFGFLAG_SERVER, ConMuteIP, this, "
|
|||
CONSOLE_COMMAND("unmute", "v[id]", CFGFLAG_SERVER, ConUnmute, this, "")
|
||||
CONSOLE_COMMAND("mutes", "", CFGFLAG_SERVER, ConMutes, this, "")
|
||||
CONSOLE_COMMAND("moderate", "", CFGFLAG_SERVER, ConModerate, this, "Enables/disables active moderator mode for the player")
|
||||
CONSOLE_COMMAND("vote_no", "", CFGFLAG_SERVER, ConVoteNo, this, "Same as \"vote no\", used by helpers")
|
||||
|
||||
CONSOLE_COMMAND("freezehammer", "v[id]", CFGFLAG_SERVER|CMDFLAG_TEST, ConFreezeHammer, this, "Gives a player Freeze Hammer")
|
||||
CONSOLE_COMMAND("unfreezehammer", "v[id]", CFGFLAG_SERVER|CMDFLAG_TEST, ConUnFreezeHammer, this, "Removes Freeze Hammer from a player")
|
||||
|
|
|
@ -573,3 +573,20 @@ void CGameContext::ConUnFreezeHammer(IConsole::IResult *pResult, void *pUserData
|
|||
|
||||
pChr->m_FreezeHammer = false;
|
||||
}
|
||||
void CGameContext::ConVoteNo(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
|
||||
// check if there is a vote running
|
||||
if(!pSelf->m_VoteCloseTime)
|
||||
return;
|
||||
|
||||
pSelf->m_VoteEnforce = CGameContext::VOTE_ENFORCE_NO_ADMIN;
|
||||
pSelf->m_VoteEnforcer = pResult->m_ClientID;
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "%s forced vote %s", pResult->GetString(0),
|
||||
pSelf->m_apPlayers[pResult->m_ClientID]->GetAuthStateName(true));
|
||||
pSelf->SendChatTarget(-1, aBuf);
|
||||
str_format(aBuf, sizeof(aBuf), "forcing vote %s", pResult->GetString(0));
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
|
||||
}
|
|
@ -2421,7 +2421,8 @@ void CGameContext::ConVote(IConsole::IResult *pResult, void *pUserData)
|
|||
pSelf->m_VoteEnforce = CGameContext::VOTE_ENFORCE_NO_ADMIN;
|
||||
pSelf->m_VoteEnforcer = pResult->m_ClientID;
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "moderator forced vote %s", pResult->GetString(0));
|
||||
str_format(aBuf, sizeof(aBuf), "%s forced vote %s", pResult->GetString(0),
|
||||
pSelf->m_apPlayers[pResult->m_ClientID]->GetAuthStateName(true));
|
||||
pSelf->SendChatTarget(-1, aBuf);
|
||||
str_format(aBuf, sizeof(aBuf), "forcing vote %s", pResult->GetString(0));
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
|
||||
|
|
|
@ -336,6 +336,7 @@ private:
|
|||
static void ConSetTimerType(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConRescue(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConProtectedKill(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConVoteNo(IConsole::IResult *pResult, void *pUserData);
|
||||
|
||||
static void ConMute(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConMuteID(IConsole::IResult *pResult, void *pUserData);
|
||||
|
|
|
@ -778,3 +778,17 @@ void CPlayer::SpectatePlayerName(const char *pName)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char* CPlayer::GetAuthStateName(bool IsFirstWord)
|
||||
{
|
||||
int State = Server()->GetAuthedState(m_ClientID);
|
||||
|
||||
if(State == IServer::AUTHED_HELPER)
|
||||
return IsFirstWord ? "Helper" : "helper";
|
||||
if(State == IServer::AUTHED_MOD)
|
||||
return IsFirstWord ? "Moderator" : "moderator";
|
||||
if(State == IServer::AUTHED_NO)
|
||||
return IsFirstWord ? "Admin" : "admin";
|
||||
|
||||
return IsFirstWord ? "User" : "user";
|
||||
}
|
||||
|
|
|
@ -160,6 +160,8 @@ public:
|
|||
int Pause(int State, bool Force);
|
||||
int ForcePause(int Time);
|
||||
int IsPaused();
|
||||
|
||||
const char* GetAuthStateName(bool IsFirstWord = false);
|
||||
|
||||
bool IsPlaying();
|
||||
int64 m_Last_KickVote;
|
||||
|
|
Loading…
Reference in a new issue