Cleaned up helper commands, @heinrich5991 please revise this commit

This commit is contained in:
GreYFoX 2011-04-15 05:20:52 +02:00
parent a2e4e9c050
commit 3f0ad1ab65
2 changed files with 3 additions and 9 deletions

View file

@ -22,8 +22,7 @@ enum
CFGFLAG_STORE=8,
CFGFLAG_MASTER=16,
// DDRace
CMDFLAG_CHEAT=32,
CMDFLAG_HELPERCMD=64
CMDFLAG_CHEAT=32
};
#endif

View file

@ -328,7 +328,7 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID, in
if(Result.GetVictim() == CResult::VICTIM_ME)
Result.SetVictim(ClientID);
if((Level < pCommand->m_Level && !(pCommand->m_Flags & CMDFLAG_HELPERCMD)) || (Level < 1 && (pCommand->m_Flags & CMDFLAG_HELPERCMD)))
if(Level < pCommand->m_Level)
{
char aBuf[256];
if (pCommand->m_Level == 100 && Level < 100)
@ -342,11 +342,6 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr, int ClientID, in
}
Result.Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
}
else if(Level == 1 && (pCommand->m_Flags & CMDFLAG_HELPERCMD) && Result.GetVictim() != ClientID)
{
Result.Print(OUTPUT_LEVEL_STANDARD, "Console", "As a helper you can't use commands on others.");
dbg_msg("server", "helper tried rcon command ('%s') on others without permission. ClientID=%d", pCommand->m_pName, ClientID);
}
else if((!g_Config.m_SvCheats || g_Config.m_SvRegister) && (pCommand->m_Flags & CMDFLAG_CHEAT))
{
Result.Print(OUTPUT_LEVEL_STANDARD, "Console", "Cheats are not allowed on registered or un-passworded servers");
@ -777,7 +772,7 @@ void CConsole::List(IConsole::IResult *pResult, int Level, int Flags)
{
if(str_comp_num(pCommand->m_pName, "sv_", 3) && str_comp_num(pCommand->m_pName, "dbg_", 4)) // ignore configs and debug commands
{
if((pCommand->m_Flags & Flags) == Flags && (pCommand->m_Level == Level || (Level == 1 && (pCommand->m_Flags & CMDFLAG_HELPERCMD))))
if((pCommand->m_Flags & Flags) == Flags && (pCommand->m_Level == Level))
{
unsigned CommandLength = str_length(pCommand->m_pName);
if(Length + CommandLength + 2 >= sizeof(aBuf) || aBuf[0] == 0)