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![]()
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![]()
To make this easier ill just post my code and then help me.
now im not sure what to add in ZChat_Cmds.cppCode: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; } } }
any help ?
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 shit ..
by the way you mean this function ?
If you do, what do i put in the () ?? if i want it to make it change by whatever the player wantsCode:ZGetGame()->m_pMyCharacter->SetHP(0);
what to use im not sure ..Code:ZGetGame()->m_pMyCharacter->SetHP("%d" || "%s" || "%i");
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 anywayOriginally Posted by ofiritsmeeee
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
Now, i know that its immpossible to convert a flaot to a character, but i dont know what to do any ideas ?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); }
Last edited by Rejain; 10-01-13 at 08:02 PM.
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.
now once i output it in game it kills me but shows that the targetname is the one who kill me.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); }
example :
/kill sahar042
sahar042 Has Defeated You.
Last edited by Rejain; 11-01-13 at 11:40 PM.
Lines will be way off.
ZChat_Cmds.cpp, 85
ZChat_Cmds.cpp, 190Code:void ChatCmd_AdminSetHP(const char* line, const int argc, char **const argv);
ZChat_Cmds.cpp, 1326Code:_CC_AC("sethp", &ChatCmd_AdminSetHP, CCF_ADMIN, ARGVNoMin, 2 , true,"/sethp <name> <value>", "");
ZGameClient_OnCommand.cpp, 800Code:void ChatCmd_AdminSetHP(const char* line, const int argc, char **const argv) { if (argc < 3) { ZChatOutput("Use: /sethp <name> <value>.", ZChat::CMT_SYSTEM); return; } ZPOSTCMD3(MC_MATCH_SET_HP, MCmdParamStr(ZGetMyInfo()->GetCharName()), MCmdParamStr(argv[1]), MCmdParamInt(atoi(argv[2]))); }
MSharedCommandTable.cpp, 1685Code:case MC_MATCH_SET_HP: { if(!ZGetGame()) return false; char szSenderName[128]=""; char szTargetName[128]=""; int nHP = 0; pCommand->GetParameter(szSenderName, 0, MPT_STR, sizeof(szSenderName) ); pCommand->GetParameter(szTargetName, 1, MPT_STR, sizeof(szTargetName) ); pCommand->GetParameter(&nHP, 2, MPT_INT, sizeof(nHP) ); OnSetHP(szSenderName, nHP); } break;
MSharedCommandTable.h, 674Code:C(MC_MATCH_SET_HP, "Match.Set.HP", "Admin SET HP", MCDT_MACHINE2MACHINE) P(MPT_STR, "SenderName") P(MPT_STR, "TargetName") P(MPT_INT, "Value")
MMatchServer_OnCommand.cpp, 1010Code:#define MC_MATCH_SET_HP 50014 // Use the last number you have and add one to it.
MMatchServer.cpp, 2126Code:case MC_MATCH_SET_HP: { char szSenderName[ MAX_CHARNAME_LENGTH ]=""; char szTargetName[ MAX_CHARNAME_LENGTH ]=""; int nHP = 0; if (pCommand->GetParameter(szSenderName, 0, MPT_STR, MAX_CHARNAME_LENGTH ) == false) break; if (pCommand->GetParameter(szTargetName, 1, MPT_STR, MAX_CHARNAME_LENGTH ) == false) break; pCommand->GetParameter(&nHP, 2, MPT_INT); OnSetHP(szSenderName, szTargetName, nHP); } break;
MMatchServer.h, 397Code:void MMatchServer::OnSetHP(char* pszSenderName, char* pszTargetName, int nHP) { MMatchObject* pObj = GetPlayerByName(pszSenderName); if (pObj == NULL) return; if(!IsAdminGrade(pObj)) return; MMatchObject* pTargetObj = GetPlayerByName(pszTargetName); if (pTargetObj == NULL) { NotifyMessage(pObj->GetUID(), MATCHNOTIFY_GENERAL_USER_NOTFOUND); return; } MCommand* pCmd = CreateCommand(MC_MATCH_SET_HP, MUID(0,0)); pCmd->AddParameter(new MCmdParamStr(pObj->GetName())); pCmd->AddParameter(new MCmdParamStr(pszTargetName)); pCmd->AddParameter(new MCmdParamInt(nHP)); RouteToListener(pTargetObj, pCmd); }
ZGameClient.cpp, 1996Code:void OnSetHP(char* pszSenderName, char* pszTargetName, int nHP);
ZGameClient.h, 164Code:void ZGameClient::OnSetHP(char* pszSenderName, int nHP) { if((float)nHP > ZGetGame()->m_pMyCharacter->GetMaxHP()) return; ZGetGame()->m_pMyCharacter->SetHP(nHP); }
Code:void OnSetHP(char* pszSenderName, int nHP);
Last edited by Vusion; 12-01-13 at 09:52 PM.
so this is also not save?