• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Kill All Command

Newbie Spellweaver
Joined
Apr 29, 2015
Messages
75
Reaction score
6
This Command Kill All The Room (it's kill yourself too)

Gunz/ZChat_Cmds.cpp
Code:

void ChatCmd_Killall(const char* line, const int argc, char **const argv);

Code:

_CC_AC("killall", &ChatCmd_Killall, CCF_ADMIN|CCF_GAME, ARGVNoMin, 1, true, "/killall", "");

Code:

void ChatCmd_Killall(const char* line, const int argc, char **const argv)
{
if( !ZGetGame() )
{
ZChatOutput("You're not in game.", ZChat::CMT_SYSTEM);
return;
}


char szAdminName[100] = "";
char szBuffer[128] = "";


if( argc > 2 ){
OutputCmdWrongArgument(argv[0]);


return;
}else if( argc < 2 ){
strcpy( szAdminName, "" );
strcpy( szBuffer, "Room killed.");
}else{
strcpy( szAdminName, argv[1] );
sprintf( szBuffer, "Room killed.", szAdminName );
}


ZPOSTCMD1(MC_KILL_ALL, MCmdParamStr(szAdminName));
ZChatOutput( szBuffer, ZChat::CMT_SYSTEM );
}

Gunz/ZGameClient_OnCommand.cpp

Code:

case MC_KILL_ALL:
{
char szAdminName[128] = "";


pCommand->GetParameter(szAdminName, 0, MPT_STR, sizeof(szAdminName) );


ZCharacterManager *pZCharacterManager = ZGetCharacterManager();

if (pZCharacterManager != NULL)
{
for (ZCharacterManager::iterator itor = pZCharacterManager->begin(); itor != pZCharacterManager->end(); ++itor)
{
ZCharacter* pCharacter = (*itor).second;
if (strcmp(pCharacter->GetProperty()->GetName(), szAdminName) == 0)
ZGetGame()->m_pMyCharacter->SetAP(ZGetGame()->m_pMyCharacter->GetMaxAP());
pCharacter->SetHP(0);
pCharacter->SetAP(0);
ZGetGameInterface()->ShowMessage("Room has been killed by staff.");
}
}
}
break;

CSCommon/MMatchServer_OnCommand.cpp

Code:

case MC_KILL_ALL:
{
char szAdminName[1024] = "";


if (!pCommand->GetParameter( szAdminName, 0, MPT_STR, 32 )) break;


MMatchObject* pObj = GetObjectA(pCommand->GetSenderUID());

if (pObj == NULL) break;
if(!IsAdminGrade(pObj)) break;


MCommand* pCmd = CreateCommand(MC_KILL_ALL, MUID(0,0));
pCmd->AddParameter(new MCmdParamStr(szAdminName));
RouteToStage(pObj->GetStageUID(), pCmd);
}
break;

CSCommon/MSharedCommandTable.cpp

Code:

C(MC_KILL_ALL, "Admin.KillAll", "", MCDT_MACHINE2MACHINE)
P(MPT_STR, "AdminName")

CSCommon/MSharedCommandTable.h

Code:

#define MC_KILL_ALL XXXXX
 
Last edited:
Newbie Spellweaver
Joined
Aug 15, 2015
Messages
20
Reaction score
7
Code:
if(ZGetMyInfo()->GetUGradeID() == MMUG_VIP1)return;
    else if(ZGetMyInfo()->GetUGradeID() == MMUG_VIP2)return;
    else if(ZGetMyInfo()->GetUGradeID() == MMUG_VIP3)return;
    else if(ZGetMyInfo()->GetUGradeID() == MMUG_FREE)return;
    else if(ZGetMyInfo()->GetUGradeID() == MMUG_REGULAR)return;
    else if(ZGetMyInfo()->GetUGradeID() == MMUG_STAR)return;
    else if(ZGetMyInfo()->GetUGradeID() == MMUG_CRIMINAL)return;
    else if(ZGetMyInfo()->GetUGradeID() == MMUG_WARNING_1)return;
    else if(ZGetMyInfo()->GetUGradeID() == MMUG_WARNING_2)return;
    else if(ZGetMyInfo()->GetUGradeID() == MMUG_WARNING_3)return;
    else if(ZGetMyInfo()->GetUGradeID() == MMUG_CHAT_LIMITED)return;
    else if(ZGetMyInfo()->GetUGradeID() == MMUG_PENALTY)return;

I'm sorry to inform you that this part wrong in many levels, you must make it server side check since you can change all the grade id to 999 for example as a result everyone can send the command.

I see you done check at server side.. I would just remove this code from here.
 
Back
Top