• 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.

[TUT] Making First Command (Enable/Disable)

Status
Not open for further replies.
Good Guy George
Loyal Member
Joined
Apr 12, 2009
Messages
1,260
Reaction score
239
For those who are willing to make custom command for players, enabled / disabled command one like /hpapbar etc. Here is example: (The command can be enabled in lobby/stage/game(every place)
ZChat_Cmds.cpp:
Code:
[B]Line 25:[/B]
void firstcommand(const char* line, const int argc, char **const argv);

[B]Line 161:[/B]
_CC_AC("firstcommand",	&firstcommand,	CCF_ALL, ARGVNoMin, 1, true, "/firstcommand", "");

[B]Above:[/B]
void ChatCmd_Help(const char* line, const int argc, char **const argv)

[B]Paste this:[/B]
#include "ZOptionInterface.h"
void firstcommand(const char* line, const int argc, char **const argv)
{	
	ZGetConfiguration()->GetEtc()->bfirstcommand = ((ZGetConfiguration()->GetEtc()->bfirstcommand == false) ? true : false);
	if(ZGetConfiguration()->GetEtc()->bfirstcommand)
		ZChatOutput("^2 First Command Enabled");
	else
		ZChatOutput("^2 First Command Disabled");
	ZGetOptionInterface()->SaveInterfaceOption();
}
ZConfiguration.h:
Code:
[B]Line 130:[/B]
bool        bfirstcommand;

[B]Line 448:[/B]
#define Z_ETC_FIRSTCOMMAND (ZGetConfiguration()->GetEtc()->bfirstcommand)
ZCombatInterface.cpp:
Code:
[B]
[B]Under:[/B]
ZGetScreenEffectManager()->DrawMyHPPanal(pDC);

[B]Change:[/B]
#ifdef _DEBUG to #ifdef _PUBLISH

[B]Under:[/B]
char szMsg[128] = { 0, };

[B]Paste:[/B]
				[B][COLOR="#B22222"]if(ZGetConfiguration()->GetEtc()->bfirstcommand)[/COLOR][/B]
				{
				sprintf(szMsg, "HP : %f / %f", pCharacter->GetHP(), pCharacter->GetMaxHP());
				pDC->Text(nX, nY, szMsg);

				sprintf(szMsg, "AP : %f / %f", pCharacter->GetAP(), pCharacter->GetMaxAP());
				pDC->Text(nX, nY + 30, szMsg);
				}
[/B]
*Sometimes you may get errors of "ZGetConfiguration", just include[CODE] #include  "ZConfiguration.h"
[/CODE]

Adding it to config.xml (mocrogamers idea):
ZConfiguration.cpp
Code:
[B]Under:[/B]
childElement.GetChildContents(&m_Etc.nFrameLimit_perSecond, ZTOK_ETC_FRAMELIMIT_PERSECOND);

[B]Paste:[/B]
childElement.GetChildContents(&m_Etc.bfirstcommand, ZTOK_ETC_FIRSTCOMMAND);

[B]Under:[/B]
		// FrameLimit
		parentElement.AppendText("ntt");
		aElement = parentElement.CreateChildElement(ZTOK_ETC_FRAMELIMIT_PERSECOND);
		sprintf(temp, "%i", m_Etc.nFrameLimit_perSecond);
		aElement.SetContents(temp);

[B]Paste:[/B]
		// Firstcommand
		parentElement.AppendText("ntt");
		aElement = parentElement.CreateChildElement(ZTOK_ETC_FIRSTCOMMAND);
		sprintf(temp, "%s", m_Etc.bfirstcommand?"TRUE":"FALSE");
		aElement.SetContents(temp);
ZConfiguration.cpp
Code:
[B]Under:[/B]
#define ZTOK_ETC_FRAMELIMIT_PERSECOND "FRAMELIMIT"

[B]Paste:[/B]
#define ZTOK_ETC_FIRSTCOMMAND "FIRSTCOMMAND"
Now this is a simple tut how to make custom commands, it will enable hpap bar everytime you type /firstcommand, for more info about commands and understanding them enter here: http://forum.ragezone.com/f497/adding-custom-command-packets-816740/
Like if i helped you.
 
Last edited:
Status
Not open for further replies.
Back
Top