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!

TagScanner problem

Skilled Illusionist
Joined
Oct 29, 2012
Messages
311
Reaction score
25
I'm having a problem using the TagScanner provided by member 'Lib'. I added all the codes correctly and I have no errors to compile, however, when I try to create a room with the R tag (for example), the function does not work, not even to perform instant reload.

Any codes:
my ZGameClient.cpp:

void ZGameClient::OnStageJoin(const MUID& uidChar, const MUID& uidStage, unsigned int nRoomNo, char* szStageName)
{
if (uidChar == GetPlayerUID()) {
m_nStageCursor = 0;
m_uidStage = uidStage;
m_nRoomNo = nRoomNo;

memset(m_szStageName, 0, sizeof(m_szStageName));
strcpy(m_szStageName, szStageName); // Save StageName

unsigned int nStageNameChecksum = m_szStageName[0] + m_szStageName[1] + m_szStageName[2] + m_szStageName[3];
InitPeerCrypt(uidStage, nStageNameChecksum);
CastStageBridgePeer(uidChar, uidStage);
}

MCommand* pCmd = new MCommand(m_CommandManager.GetCommandDescByID(MC_MATCH_REQUEST_STAGESETTING), GetServerUID(), m_This);
pCmd->AddParameter(new MCommandParameterUID(GetStageUID()));
Post(pCmd);

if (uidChar == GetPlayerUID())
{
ZChangeGameState(GUNZ_STAGE);
}

char szText[256];
if (uidChar == GetPlayerUID())
{
ZGetGameInterface()->GetChat()->Clear(ZChat::CL_STAGE);

char szTmp[ 256];
sprintf(szTmp, "(%03d)%s", nRoomNo, szStageName);

ZTransMsg( szText, MSG_JOINED_STAGE, 1, szTmp);
ZChatOutput(szText, ZChat::CMT_SYSTEM, ZChat::CL_STAGE);

//Room Tag Scanner
if (ZApplication::GetInstance()->GetTagScanner()->Create(szStageName) == true)
{
ZChatOutput(ZApplication::GetInstance()->GetTagScanner()->Output().c_str(), ZChat::CMT_SYSTEM, ZChat::CL_STAGE);
}

}

//////////////////////////////////////

My ZApplication.h

static ZTagScanner m_TagScanner;

__forceinline ZTagScanner* ZApplication::GetTagScanner(void)
{
return &m_TagScanner;
}

////////////////////////////////////////////////////

My ZApplication.cpp

ZTagScanner ZApplication::m_TagScanner;

////////////////////////////////////////

My TagScanner.h (included in Gunz project)

#include "stdafx.h"

#ifndef _ZTAGSCANNER_H
#define _ZTAGSCANNER_H

enum ZTagNames
{
ZTN_DMG2,
ZTN_DMG3,
ZTN_R,
ZTN_END = 32
};

class ZTagScanner
{
protected:

// Storage Settings;
int nTags[32];
int nNumber[32];
string strOutput;
private:
int SetTags(int A, int B, int C = 0)
{
nTags[A] = B;
nNumber[A] = C;
}
public:
ZTagScanner() { };
~ZTagScanner() { };


bool Find(int A, int B)
{
if (nTags[A] == B)
return true;
else
return false;
}

int Param(int A)
{
return nNumber[A];
}

string Output()
{
return strOutput;
}

bool Create(const char* StageName)
{
#ifndef _ROOMTAGS
return false;
#endif
char RoomName[STAGENAME_LENGTH];
memcpy(RoomName, StageName, STAGENAME_LENGTH);

for (int i = 0; i < STAGENAME_LENGTH; i++)
{
RoomName = tolower(RoomName);
}

for (int i = 0; i < 32; i++)
{
nTags = 0;
nNumber = 0;
}

strOutput = "";

int nRoomMod = 0;
int nNumber = 0;

char szPreOutput[512] = "";

#define ADD_ROOMMOD_STR(name) \
{ \
strcat(szPreOutput, name); \
strcat(szPreOutput, " - "); \
nRoomMod++; \
}

#define FINALIZE_ROOMMOD_STR() \
{ \
int nStrLen = (int) strlen(szPreOutput); \
static const int nRemoveLen = (int) strlen(" - "); \
szPreOutput[nStrLen - nRemoveLen] = '\0'; \
}

#ifdef _ROOMTAGS
#ifdef _ROOMTAG_DMG
if (strstr(RoomName, "[dmg2]"))
{
this->SetTags(ZTN_DMG2, TRUE);
ADD_ROOMMOD_STR("Multiple damage");
}
else
{
this->SetTags(ZTN_DMG2, FALSE);
}

if (strstr(RoomName, "[dmg3]"))
{
this->SetTags(ZTN_DMG3, TRUE);
ADD_ROOMMOD_STR("Triple damage");
}
else
{
this->SetTags(ZTN_DMG2, FALSE);
}
#endif
#ifdef _ROOMTAG_RELOAD
if (strstr(RoomName, "[r]"))
{
this->SetTags(ZTN_R, TRUE);
ADD_ROOMMOD_STR("Auto reload");
}
else
{
this->SetTags(ZTN_R, FALSE);
}
#endif
#endif
if (nRoomMod != 0)
{
FINALIZE_ROOMMOD_STR();
char szOutput[1024];
sprintf(szOutput, "[Room Modifiers (%d)] %s", nRoomMod, szPreOutput);
strOutput = szOutput;
}
return true;
}
};

#endif

/////////////////////
My room tags

If(ZApplication::GetInstance()->GetTagScanner()->Find(ZTN_R, TRUE) == true)
pCharacter->GetItems()->Reload();


Anyone can help me ?
 
Experienced Elementalist
Joined
Oct 14, 2015
Messages
290
Reaction score
83
It's working correctly.
Remove the:
Code:
return false;
Your problem will be solved.
iB42BOc - TagScanner problem - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Upvote 0
Skilled Illusionist
Joined
Oct 29, 2012
Messages
311
Reaction score
25
It's working correctly.
Remove the:
Code:
return false;
Your problem will be solved.
iB42BOc - TagScanner problem - RaGEZONE Forums

Thanks for answer, but still not working. Please check/test my code in the spoiler. I have 2 "return false" in my TagScanner (see "#ifndef _ROOMTAGS" and "bool Find(".
I try comment both, 1 at time but doenst work
 

Attachments

You must be registered for see attachments list
Upvote 0
Experienced Elementalist
Joined
Oct 14, 2015
Messages
290
Reaction score
83
Thanks for answer, but still not working. Please check/test my code in the spoiler. I have 2 "return false" in my TagScanner (see "#ifndef _ROOMTAGS" and "bool Find(".
I try comment both, 1 at time but doenst work
Go to ZTagScanner.h
Code:
bool Create(const char* StageName)
Remove:
Code:
//#ifndef _ROOMTAGS
//        return false;
//#endif
 
Last edited:
Upvote 0
Skilled Illusionist
Joined
Oct 29, 2012
Messages
311
Reaction score
25
Omg, not working...something this wrong

See:

Not even my [r] function does work if i add scanner function, like this:
Code:
If(ZApplication::GetInstance()->GetTagScanner()->Find(ZTN_R, TRUE) == true)

I join in the room and the fast reload not working. But the original code of FR working perfectly. The same for [dmg2]/3.
I follow the tutorial by lib, the GetTagScanner function declared inline void, everthing right i guess...
 
Upvote 0
Back
Top