Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

How To make a command that changes an aponennt hp and ap.

Experienced Elementalist
Joined
Jul 15, 2012
Messages
201
Reaction score
2
Hi, im using a1tl4's room tag and i want to convert it into a command, i dont know how to do it, like how to change hp and ap, to add 2 paramters to the command for example :
/sethpap Rejain 120 100

you guys got it ?
Thanks for the helpers hahaha :D:
 
Experienced Elementalist
Joined
Sep 14, 2011
Messages
265
Reaction score
6
Hi, im using a1tl4's room tag and i want to convert it into a command, i dont know how to do it, like how to change hp and ap, to add 2 paramters to the command for example :
/sethpap Rejain 120 100

you guys got it ?
Thanks for the helpers hahaha :D:
I already done /maxhp <playername> which heals your char to your max HP and ap..
Just Use :
Code:
ZGetGame()->m_pMyCharacter->SetHP(ZGetGame()->m_pMyCharacter->GetMaxHP());
ZGetGame()->m_pMyCharacter->SetAP(ZGetGame()->m_pMyCharacter->GetMaxAP());
 
Upvote 0
Experienced Elementalist
Joined
Jul 15, 2012
Messages
201
Reaction score
2
Use paramater to do it.
Thats what i want to know how to do, im not sure how to do it ? whould i add a variable in ZCharacter.h and use seomthing like the Godmode command ?
 
Upvote 0
Experienced Elementalist
Joined
Jul 15, 2012
Messages
201
Reaction score
2
int numhp;
int numap;
would help.



BTW sahar , could you give me the HEX color was on game-servGunz for VIP's?
To make this easier ill just post my code and then help me.
Code:
void ZCharacter::SetHPAp()
{
	int newhp = 0;
	int newap = 0;
	if(ZGetConfiguration()->GetEtc()->bsethpap)
	{
		if(newhp > 0)
		{
			m_Property.fMaxHP.Set_CheckCrc(newhp);
			m_fPreMaxHP = newhp;
		}
		if(newap > 0)
		{
			m_Property.fMaxAP.Set_CheckCrc(newap);
			m_fPreMaxAP = newap;
		}
		else
		{
			m_Property.fMaxHP.Set_CheckCrc(pCharInfo->nHP + fAddedHP);
			m_fPreMaxHP = pCharInfo->nHP + fAddedHP;
			m_Property.fMaxAP.Set_CheckCrc(pCharInfo->nAP + fAddedAP);
			m_fPreMaxAP = pCharInfo->nAP + fAddedAP;
		}
	}
}
now im not sure what to add in ZChat_Cmds.cpp
any help ?
 
Upvote 0
Experienced Elementalist
Joined
Sep 14, 2011
Messages
265
Reaction score
6
To make this easier ill just post my code and then help me.
Code:
void ZCharacter::SetHPAp()
{
	int newhp = 0;
	int newap = 0;
	if(ZGetConfiguration()->GetEtc()->bsethpap)
	{
		if(newhp > 0)
		{
			m_Property.fMaxHP.Set_CheckCrc(newhp);
			m_fPreMaxHP = newhp;
		}
		if(newap > 0)
		{
			m_Property.fMaxAP.Set_CheckCrc(newap);
			m_fPreMaxAP = newap;
		}
		else
		{
			m_Property.fMaxHP.Set_CheckCrc(pCharInfo->nHP + fAddedHP);
			m_fPreMaxHP = pCharInfo->nHP + fAddedHP;
			m_Property.fMaxAP.Set_CheckCrc(pCharInfo->nAP + fAddedAP);
			m_fPreMaxAP = pCharInfo->nAP + fAddedAP;
		}
	}
}
now im not sure what to add in ZChat_Cmds.cpp
any help ?
-_-'
you're doing it wrong , why are you using ENABLE\DISABLE COMMAND?
 
Upvote 0
Experienced Elementalist
Joined
Jul 15, 2012
Messages
201
Reaction score
2
-_-'
you're doing it wrong , why are you using ENABLE\DISABLE COMMAND?
I can change it, btw i dont really know how to make other commands LOL
THATS WHY I OPENED THE THREAD TO KNOW HOW TO MAKE A DIFFRENT KIND OF COMMAND
 
Upvote 0
Good Guy George
Loyal Member
Joined
Apr 12, 2009
Messages
1,260
Reaction score
240
I got it, you need to do a new packet with the targetname. I may tmw share you it.
The code you posted is very very wrong. All you need is to use sethp(int)
 
Upvote 0
Experienced Elementalist
Joined
Sep 14, 2011
Messages
265
Reaction score
6
I can change it, btw i dont really know how to make other commands LOL
THATS WHY I OPENED THE THREAD TO KNOW HOW TO MAKE A DIFFRENT KIND OF COMMAND
You need to make the command like that:
Code:
char* szTargetName = argv[1];
Your code is very wrong because the command is ENABLE\DISABLE.
 
Upvote 0
Experienced Elementalist
Joined
Jul 15, 2012
Messages
201
Reaction score
2
I got it, you need to do a new packet with the targetname. I may tmw share you it.
The code you posted is very very wrong. All you need is to use sethp(int)
What do you mean can you be more specific ? or maybe make a tut like you did for disable/enable only with more packets and poop ..
by the way you mean this function ?
Code:
ZGetGame()->m_pMyCharacter->SetHP(0);
If you do, what do i put in the () ?? if i want it to make it change by whatever the player wants
Code:
ZGetGame()->m_pMyCharacter->SetHP("%d" || "%s" || "%i");
what to use im not sure ..
Thanks anyway.

ofiritsmeeee said:
Your code is very wrong because the command is ENABLE\DISABLE.
ik that, thanks for helping, but what i also need is the set hp parameter and set ap parameter, which im not sure how to make, thanks anyway

OFF TOPIC :
im using iGunz website, and it dosent work in chrome any fix ?

EDIT : i have been working on it, and i am trying to build this code in ZChat_Cmds.cpp
Code:
void sethp(const char* line, const int argc, char **const argv)
{
    if (argc < 4)
    {
       ZChatOutput("^2Please enter a player name and a value of hp and ap !", ZChat::CMT_SYSTEM);
		return;
    }
	float newhp = 0;
	float newap = 0;
	char* szhpnum = argv[1];
	char* szapnum = argv[2];
	char* szTargetName = argv[3];
	newhp = szhpnum;
	newhp = szapnum;
	ZGetGame()->m_pMyCharacter->SetHP(newhp);
	ZGetGame()->m_pMyCharacter->SetAP(newap);
	ZChatOutput("^2HP and AP succsessfully changed !", ZChat::CMT_SYSTEM);
}
Now, i know that its immpossible to convert a flaot to a character, but i dont know what to do any ideas ?
 
Last edited:
Upvote 0
Experienced Elementalist
Joined
Sep 14, 2011
Messages
265
Reaction score
6
What do you mean can you be more specific ? or maybe make a tut like you did for disable/enable only with more packets and poop ..
by the way you mean this function ?
Code:
ZGetGame()->m_pMyCharacter->SetHP(0);
If you do, what do i put in the () ?? if i want it to make it change by whatever the player wants
Code:
ZGetGame()->m_pMyCharacter->SetHP("%d" || "%s" || "%i");
what to use im not sure ..
Thanks anyway.


ik that, thanks for helping, but what i also need is the set hp parameter and set ap parameter, which im not sure how to make, thanks anyway

OFF TOPIC :
im using iGunz website, and it dosent work in chrome any fix ?

EDIT : i have been working on it, and i am trying to build this code in ZChat_Cmds.cpp
Code:
void sethp(const char* line, const int argc, char **const argv)
{
    if (argc < 4)
    {
       ZChatOutput("^2Please enter a player name and a value of hp and ap !", ZChat::CMT_SYSTEM);
		return;
    }
	float newhp = 0;
	float newap = 0;
	char* szhpnum = argv[1];
	char* szapnum = argv[2];
	char* szTargetName = argv[3];
	newhp = szhpnum;
	newhp = szapnum;
	ZGetGame()->m_pMyCharacter->SetHP(newhp);
	ZGetGame()->m_pMyCharacter->SetAP(newap);
	ZChatOutput("^2HP and AP succsessfully changed !", ZChat::CMT_SYSTEM);
}
Now, i know that its immpossible to convert a flaot to a character, but i dont know what to do any ideas ?
You're still doing it wrong..
You need a packet for that , not all the function is in the ZchatCMDS.CPP.
 
Upvote 0
Experienced Elementalist
Joined
Jul 15, 2012
Messages
201
Reaction score
2
You're still doing it wrong..
You need a packet for that , not all the function is in the ZchatCMDS.CPP.
OMG.. i made this thread so people will HELP ME not tell me if im doing it wrong or right ..
 
Upvote 0
Experienced Elementalist
Joined
Jul 15, 2012
Messages
201
Reaction score
2
We are helping to you, No one going to do it for you.
We told you to do parameter, More hint - You can copy whisper parameters and edit it.
Lol, all im asking for is an example for parameters and how to use them, is that such a big request ?
You know what, i am even working on an easier example.
Code:
void kill(const char* line, const int argc, char **const argv)
{
    if (argc < 2)
    {
       ZChatOutput("^2Please enter a player name !", ZChat::CMT_SYSTEM);
		return;
    }
	char szMsg[256];
	char* szTargetName = argv[1];
	ZCharacter* pChar = ZGetGame()->m_pMyCharacter;
	pChar->SetHP(0);
	pChar->SetAP(0);
	sprintf(szMsg, "^2You have killed %s.", szTargetName);
	ZChatOutput(szMsg);
}
now once i output it in game it kills me but shows that the targetname is the one who kill me.
example :
/kill sahar042
sahar042 Has Defeated You.
 
Upvote 0
Good Guy George
Loyal Member
Joined
Apr 12, 2009
Messages
1,260
Reaction score
240
Lol, all im asking for is an example for parameters and how to use them, is that such a big request ?
You know what, i am even working on an easier example.
Code:
void kill(const char* line, const int argc, char **const argv)
{
    if (argc < 2)
    {
       ZChatOutput("^2Please enter a player name !", ZChat::CMT_SYSTEM);
		return;
    }
	char szMsg[256];
	char* szTargetName = argv[1];
	ZCharacter* pChar = ZGetGame()->m_pMyCharacter;
	pChar->SetHP(0);
	pChar->SetAP(0);
	sprintf(szMsg, "^2You have killed %s.", szTargetName);
	ZChatOutput(szMsg);
}
now once i output it in game it kills me but shows that the targetname is the one who kill me.
example :
/kill sahar042
sahar042 Has Defeated You.

Dude, by the command you only post the packet with the info, you can't kill them in the same place where the command coded, it's not actually sending it.

Make new Packet, follow zpostwhisper
 
Upvote 0
Experienced Elementalist
Joined
Jul 15, 2012
Messages
201
Reaction score
2
Dude, by the command you only post the packet with the info, you can't kill them in the same place where the command coded, it's not actually sending it.

Make new Packet, follow zpostwhisper
Dude......................................................................
Thanks, i did that but in game it dc's me .. can you help me ? thanks.
 
Last edited:
Upvote 0
Experienced Elementalist
Joined
Sep 14, 2011
Messages
265
Reaction score
6
Dude......................................................................
Thanks, i did that but in game it dc's me .. can you help me ? thanks.
So you did it wrong , again.
We are not going to post you all the source code because it was edited in like 10 files , use Qet's system.
 
Upvote 0
Experienced Elementalist
Joined
Jul 15, 2012
Messages
201
Reaction score
2
So you did it wrong , again.
We are not going to post you all the source code because it was edited in like 10 files , use Qet's system.
No, it sux.. it dosent work .....
I AM NOT ASKING FOR YOU TO POST ME IT ONLY AN EXAMPLE OMG WHATS SO HARD TO UNDERSTAND:grr::grr::grr::grr::grr::grr::grr: ?!
 
Upvote 0
Back
Top