mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 17:44:18 +00:00
add /modhelp chat command
This commit is contained in:
parent
fd7d1463fc
commit
79fedff12d
|
@ -1363,6 +1363,45 @@ void CGameContext::ConProtectedKill(IConsole::IResult *pResult, void *pUserData)
|
|||
//pSelf->SendChatTarget(pResult->m_ClientID, aBuf);
|
||||
}
|
||||
}
|
||||
|
||||
void CGameContext::ConModHelp(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *) pUserData;
|
||||
|
||||
if (!CheckClientID(pResult->m_ClientID))
|
||||
return;
|
||||
|
||||
CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID];
|
||||
if (!pPlayer)
|
||||
return;
|
||||
|
||||
if(pPlayer->m_ModHelpTick > pSelf->Server()->Tick())
|
||||
{
|
||||
char aBuf[126];
|
||||
str_format(aBuf, sizeof(aBuf), "You must wait %d seconds to execute this command again.",
|
||||
(pPlayer->m_ModHelpTick - pSelf->Server()->Tick()) / pSelf->Server()->TickSpeed());
|
||||
pSelf->SendChatTarget(pResult->m_ClientID, aBuf);
|
||||
return;
|
||||
}
|
||||
|
||||
pPlayer->m_ModHelpTick = pSelf->Server()->Tick() + g_Config.m_SvModHelpDelay * pSelf->Server()->TickSpeed();
|
||||
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "Moderator help is requested by %s (ID: %d):",
|
||||
pSelf->Server()->ClientName(pResult->m_ClientID),
|
||||
pResult->m_ClientID);
|
||||
|
||||
// Send the request to all authed clients.
|
||||
for ( int i = 0; i < MAX_CLIENTS; i++ )
|
||||
{
|
||||
if(pSelf->m_apPlayers[i] && pSelf->m_apPlayers[i]->m_Authed)
|
||||
{
|
||||
pSelf->SendChatTarget(pSelf->m_apPlayers[i]->GetCID(), aBuf);
|
||||
pSelf->SendChatTarget(pSelf->m_apPlayers[i]->GetCID(), pResult->GetString(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CONF_SQL)
|
||||
void CGameContext::ConPoints(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
|
|
|
@ -47,6 +47,8 @@ CHAT_COMMAND("rescue", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConRescue, this, "Telepo
|
|||
|
||||
CHAT_COMMAND("kill", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConProtectedKill, this, "Kill yourself")
|
||||
|
||||
CHAT_COMMAND("modhelp", "r[message]", CFGFLAG_CHAT|CFGFLAG_SERVER, ConModHelp, this, "Request the help of a moderator with a description of the problem")
|
||||
|
||||
#if defined(CONF_SQL)
|
||||
CHAT_COMMAND("times", "?s[player name] ?i[number of times to skip]", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTimes, this, "/times ?s?i shows last 5 times of the server or of a player beginning with name s starting with time i (i = 1 by default)")
|
||||
CHAT_COMMAND("points", "?r[player name]", CFGFLAG_CHAT|CFGFLAG_SERVER, ConPoints, this, "Shows the global points of a player beginning with name r (your rank by default)")
|
||||
|
|
|
@ -343,6 +343,7 @@ private:
|
|||
static void ConUnmute(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConMutes(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConModerate(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConModHelp(IConsole::IResult *pResult, void *pUserData);
|
||||
|
||||
static void ConList(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConSetDDRTeam(IConsole::IResult *pResult, void *pUserData);
|
||||
|
|
|
@ -70,6 +70,7 @@ void CPlayer::Reset()
|
|||
m_LastWhisperTo = -1;
|
||||
m_LastSetSpectatorMode = 0;
|
||||
m_TimeoutCode[0] = '\0';
|
||||
m_ModHelpTick = 0;
|
||||
|
||||
m_TuneZone = 0;
|
||||
m_TuneZoneOld = m_TuneZone;
|
||||
|
|
|
@ -177,6 +177,7 @@ public:
|
|||
int m_ChatScore;
|
||||
|
||||
bool m_Moderating;
|
||||
int m_ModHelpTick;
|
||||
|
||||
bool AfkTimer(int new_target_x, int new_target_y); //returns true if kicked
|
||||
void AfkVoteTimer(CNetObj_PlayerInput *NewTarget);
|
||||
|
|
|
@ -164,6 +164,8 @@ MACRO_CONFIG_INT(SvSendVotesPerTick, sv_send_votes_per_tick, 5, 1, 15, CFGFLAG_S
|
|||
MACRO_CONFIG_INT(SvRescue, sv_rescue, 0, 0, 1, CFGFLAG_SERVER, "Allow /rescue command so players can teleport themselves out of freeze")
|
||||
MACRO_CONFIG_INT(SvRescueDelay, sv_rescue_delay, 5, 0, 1000, CFGFLAG_SERVER, "Number of seconds inbetween two rescues")
|
||||
|
||||
MACRO_CONFIG_INT(SvModHelpDelay, sv_modhelp_delay, 60, 0, 0, CFGFLAG_SERVER, "Number of seconds to wait before executing /modhelp again")
|
||||
|
||||
// debug
|
||||
#ifdef CONF_DEBUG // this one can crash the server if not used correctly
|
||||
MACRO_CONFIG_INT(DbgDummies, dbg_dummies, 0, 0, 15, CFGFLAG_SERVER, "")
|
||||
|
|
Loading…
Reference in a new issue