ZChat_Cmds.cpp
Code:void clanchannelpassword(const char* line, const int argc, char **const argv); void clanchannelremovepassword(const char* line, const int argc, char **const argv);
Code:_CC_AC("ccpw", &clanchannelpassword, CCF_ALL, ARGVNoMin, 1, true, "/ccpw <password>", ""); _CC_AC("ccnpw", &clanchannelremovepassword, CCF_LOBBY, ARGVNoMin, 1, true, "/ccnpw <password>", "");
void clanchannelpassword(const char* line,const int argc, char **const argv)
{
if(argc == 2)
ZPostClanChannelPassword(argv[1], true);
else
ZChatOutput("Usage: /ccpw <password>");
}
void clanchannelremovepassword(const char* line,const int argc, char **const argv)
{
if(argc == 1)
ZPostClanChannelPassword("", false);
else
ZChatOutput("Usage: /ccnpw");
}
ZGameInterface.cpp
SetListenerWidget("SumbitPassword", ZGetSumbitPassword());
ZGameClient_OnCommand.cpp
Code:case MC_MATCH_SUMBITPW: { char szPassword[32]; char szClanName[65]; pCommand->GetParameter(szPassword, 0, MPT_STR, sizeof(szPassword) ); CheckMsgAboutChat(szPassword); memcpy(ZGetConfiguration()->GetEtc()->szPassword, szPassword, sizeof(szPassword) + 32); pCommand->GetParameter(szClanName, 1, MPT_STR, sizeof(szClanName) ); memcpy(ZGetConfiguration()->GetEtc()->szClanName, szClanName, sizeof(szClanName) + 65); MWidget* pFindWidget = ZGetGameInterface()->GetIDLResource()->FindWidget("ClanSumbitPassword"); if(pFindWidget != NULL) pFindWidget->Show(true, true); MEdit* pClanName = (MEdit*)ZGetGameInterface()->GetIDLResource()->FindWidget("ClanName"); if(pClanName != NULL) pClanName->SetText(szClanName); MEdit* pPassEdit = (MEdit*)ZGetGameInterface()->GetIDLResource()->FindWidget("ClanPassword"); if(pPassEdit != NULL) { pPassEdit->SetMaxLength(STAGEPASSWD_LENGTH); pPassEdit->SetText(""); } ZGetConfiguration()->GetEtc()->bEnablePasswordCheck = true; } break;
Zpost.h
Code:inline void ZPostClanChannelPassword(char* szPassword, bool bVal) { ZPOSTCMD2(MC_MATCH_CCPW, MCmdParamStr(szPassword), MCommandParameterBool(bVal)); }
Under
Code:C(MC_MATCH_NOTIFY, "Match.Notify", "Notify Message", MCDT_MACHINE2MACHINE) P(MPT_UINT, "nMsgID")
Add
Code:C(MC_MATCH_CCPW, "Match.Ccpw", "Clan Channel Password", MCDT_MACHINE2MACHINE) P(MPT_STR, "Password") P(MPT_BOOL, "Value")
find :
Code:inline void ZPostChannelRequestJoin
add
Code:inline void ZPostChannelRequestJoin(const MUID& uidChar, const MUID& uidChannel, bool bCorrectPW, char* szPW) { ZPOSTCMD4(MC_MATCH_CHANNEL_REQUEST_JOIN, MCommandParameterUID(uidChar), MCommandParameterUID(uidChannel), MCommandParameterBool(bCorrectPW), MCommandParameterString(szPW)); }
find :
Code:inline void ZPostChannelRequestJoinFromChannelName
add :
Code:inline void ZPostChannelRequestJoinFromChannelName(const MUID& uidChar, int nChannelType, const char* szChannelName, bool bCorrectPW, char* szPW) { if (strlen(szChannelName) >= CHANNELNAME_LEN) return; ZPOSTCMD5(MC_MATCH_CHANNEL_REQUEST_JOIN_FROM_NAME, MCmdParamUID(uidChar), MCmdParamInt(nChannelType), MCmdParamStr(szChannelName), MCommandParameterBool(bCorrectPW), MCommandParameterString(szPW)); }
MSharedCommandTable.h
add in end :
Code:#define MC_MATCH_CCPW 50010 #define MC_MATCH_SUMBITPW 50011 #define MC_MATCH_REQUEST_ONLINEPLAYERS 50012 #endif
ZInterfaceListener.cpp
add to line 488
Code:BEGIN_IMPLEMENT_LISTENER(ZGetSumbitPassword, MBTN_CLK_MSG) bool bVal = ZGetConfiguration()->GetEtc()->bEnablePasswordCheck = true; if(bVal) { MEdit* pPassEdit = (MEdit*)ZGetGameInterface()->GetIDLResource()->FindWidget("ClanPassword"); if(strcmp(ZGetConfiguration()->GetEtc()->szPassword, pPassEdit->GetText())) { ZGetGameInterface()->ShowMessage("Incorrect Password!"); } else { char szPW[123]; sprintf(szPW, "%s", pPassEdit->GetText()); MWidget* pFindWidget = ZGetGameInterface()->GetIDLResource()->FindWidget("ClanSumbitPassword"); if(pFindWidget != NULL) pFindWidget->Show(false, false); ZPostChannelRequestJoinFromChannelName(ZGetGameClient()->GetPlayerUID(), MCHANNEL_TYPE_CLAN, ZGetConfiguration()->GetEtc()->szClanName, true, szPW); } Sleep(100); }
ZInterfaceListener.h
add :
Code:DECLARE_LISTENER(ZGetSumbitPassword);
Full credit to : to me for mading it and share it. have fun :)



Reply With Quote


