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

Creating Clan with 2 Players [ Source + SQL edit ]

Status
Not open for further replies.
Currently Stoned !
Joined
Dec 6, 2011
Messages
879
Reaction score
108
1) Creating clan with 2 players :-

CSCommon:

MAsyncDBJob.h :
Find
Code:
class MAsyncDBJob_CreateClan : public MAsyncJob {
Replace whole class :
Code:
////////////////////////////////////////////////////////////////////////////////////////////////////
class MAsyncDBJob_CreateClan : public MAsyncJob {
protected:
	MUID		m_uidMaster;
	MUID		m_uidMember1;
//	MUID		m_uidMember2;
//	MUID		m_uidMember3;
//	MUID		m_uidMember4;
protected: // Input Argument
	char		m_szClanName[256];
	int			m_nMasterCID;
	int			m_nMember1CID;
//	int			m_nMember2CID;
//	int			m_nMember3CID;
//	int			m_nMember4CID;
protected:	// Output Result
	bool		m_bDBResult;
	int			m_nNewCLID;
public:
	MAsyncDBJob_CreateClan(const MUID& uidOwne)	: MAsyncJob(MASYNCJOB_CREATECLAN, uidOwne) ,
											  m_bDBResult(false), 
											  m_nNewCLID(0)
	{
	
	}
	virtual ~MAsyncDBJob_CreateClan()	{}
	bool Input(const TCHAR* szClanName, 
			   const int nMasterCID, 
			   const int nMember1CID, 
	//		   const int nMember2CID,
    //         const int nMember3CID, 
	//		   const int nMember4CID,
			   const MUID& uidMaster,
			   const MUID& uidMember1);
	//		   const MUID& uidMember2,
	//		   const MUID& uidMember3,
	//		   const MUID& uidMember4);
	virtual void Run(void* pContext);
	bool GetDBResult() { return m_bDBResult; }
	int GetNewCLID() { return m_nNewCLID; }
	const MUID& GetMasterUID() { return m_uidMaster; }
	const MUID& GetMember1UID() { return m_uidMember1; }
//	const MUID& GetMember2UID() { return m_uidMember2; }
//	const MUID& GetMember3UID() { return m_uidMember3; }
//	const MUID& GetMember4UID() { return m_uidMember4; }
	const char* GetClanName() { return m_szClanName; }
};
////////////////////////////


MMatchGlobal.h
Find :
Code:
#define CLAN_SPONSORS_COUNT			4		// Ŭ·£»ý¼º½Ã ÇÊ¿äÇÑ ¹ß±âÀÎ ¼ö

Change to :
Code:
#define CLAN_SPONSORS_COUNT			1		// Ŭ·£»ý¼º½Ã ÇÊ¿äÇÑ ¹ß±âÀÎ ¼ö

MMatchDBMgr.h
Find :
Code:
bool CreateClan(const TCHAR* szClanName, const int nMasterCID, const int nMember1CID, const int nMember2CID,
		const int nMember3CID, const int nMember4CID, bool* boutRet, int* noutNewCLID);

Replace :
Code:
bool CreateClan(const TCHAR* szClanName, const int nMasterCID, const int nMember1CID, bool* boutRet, int* noutNewCLID);


MAsyncDBJob.cpp
Find :
Code:
void MAsyncDBJob_CreateClan::Run(void* pContext)
Replace whole class:
Code:
/////////////////////////////////////////////////////////////////////////////////////////////////
void MAsyncDBJob_CreateClan::Run(void* pContext)
{
	MMatchDBMgr* pDBMgr = (MMatchDBMgr*)pContext;

	if (!pDBMgr->CreateClan(m_szClanName, 
							m_nMasterCID, 
							m_nMember1CID, 
	//						m_nMember2CID, 
	//						m_nMember3CID, 
	//						m_nMember4CID, 
							&m_bDBResult, 
							&m_nNewCLID))
	{
		SetResult(MASYNC_RESULT_FAILED);

		return;
	}

	SetResult(MASYNC_RESULT_SUCCEED);
}

bool MAsyncDBJob_CreateClan::Input(const TCHAR* szClanName, 
									const int nMasterCID, 
									const int nMember1CID, 
								//	const int nMember2CID,
								//	const int nMember3CID, 
							//		const int nMember4CID,
									const MUID& uidMaster,
									const MUID& uidMember1)
							//		const MUID& uidMember2,
							//		const MUID& uidMember3,
							//		const MUID& uidMember4)
{
	strcpy(m_szClanName, szClanName);
	m_nMasterCID = nMasterCID;
	m_nMember1CID = nMember1CID;
//	m_nMember2CID = nMember2CID;
//  m_nMember3CID = nMember3CID;
//	m_nMember4CID = nMember4CID;

	m_uidMaster = uidMaster;
	m_uidMember1 = uidMember1;
//	m_uidMember2 = uidMember2;
//	m_uidMember3 = uidMember3;
//	m_uidMember4 = uidMember4;

	return true;
}

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


MMatchDBMgr.cpp
Find :
Code:
TCHAR g_szDB_CREATE_CLAN[] = _T("{CALL spCreateClan ('%s', %d, %d, %d, %d, %d)}");

Replace:
Code:
TCHAR g_szDB_CREATE_CLAN[] = _T("{CALL spCreateClan ('%s', %d, %d)}");



FIND :
Code:
bool MMatchDBMgr::CreateClan(const TCHAR* szClanName, const int nMasterCID, const int nMember1CID, const int nMember2CID,
							 const int nMember3CID, const int nMember4CID, bool* boutRet, int* noutNewCLID)

REPLACE whole case :
Code:
bool MMatchDBMgr::CreateClan(const TCHAR* szClanName, const int nMasterCID, const int nMember1CID, bool* boutRet, int* noutNewCLID)
{
	_STATUS_DB_START;
	if (!CheckOpen()) return false;



	CString strSQL;
	strSQL.Format(g_szDB_CREATE_CLAN, szClanName, nMasterCID, nMember1CID);

	CODBCRecordset rs(&m_DB);


	bool bException = false;
	try 
	{
		rs.Open(strSQL, CRecordset::forwardOnly, CRecordset::readOnly);
	} 
	catch(CDBException* e)
	{
		bException = true;

		ExceptionHandler(strSQL, e);
		return false;

		*boutRet = false;
		return false;
	}

	if ((rs.IsOpen() == FALSE) || (rs.GetRecordCount() <= 0) || (rs.IsBOF()==TRUE)) 
	{
		*boutRet = false;
		return false;
	}

	*boutRet = rs.Field("Ret").AsBool();
	*noutNewCLID = rs.Field("NewCLID").AsInt();


	_STATUS_DB_END(35);
	return true;


}


MMatchServer_Async.cpp

Find :
Code:
	_ASSERT(CLAN_SPONSORS_COUNT == 4);

	pSponsorObjects[0] = GetObject(pJob->GetMember1UID());
	pSponsorObjects[1] = GetObject(pJob->GetMember2UID());
	pSponsorObjects[2] = GetObject(pJob->GetMember3UID());
	pSponsorObjects[3] = GetObject(pJob->GetMember4UID());

Replace :
Code:
	_ASSERT(CLAN_SPONSORS_COUNT == 1);

	pSponsorObjects[0] = GetObject(pJob->GetMember1UID());
	//pSponsorObjects[1] = GetObject(pJob->GetMember2UID());
	//pSponsorObjects[2] = GetObject(pJob->GetMember3UID());
	//pSponsorObjects[3] = GetObject(pJob->GetMember4UID());

MMatchServer_Clan.cpp:

Find:
Code:
if (CLAN_SPONSORS_COUNT == 4)

Replace whole IF case :
Code:
if (CLAN_SPONSORS_COUNT == 1)
	{
		MAsyncDBJob_CreateClan* pNewJob = new MAsyncDBJob_CreateClan(uidPlayer);
		pNewJob->Input(szClanName, 
					   nMasterCID, 
					   nMemberCID[0], 
	//				   nMemberCID[1], 
	//				   nMemberCID[2], 
	//				   nMemberCID[3],
					   pMasterObject->GetUID(),
					   pSponsorObjects[0]->GetUID());
	//				   pSponsorObjects[1]->GetUID());
	//				   pSponsorObjects[2]->GetUID(),
	//				   pSponsorObjects[3]->GetUID());
		// PostAsyncJob(pNewJob);
		pMasterObject->m_DBJobQ.DBJobQ.push_back( pNewJob );
	}

MSharedCommandTable.cpp:
Find :
Code:
C(MC_MATCH_CLAN_REQUEST_AGREED_CREATE_CLAN, "Match.Clan.RequestAgreedCreateClan", "Request Agreed Create Clan", MCDT_MACHINE2MACHINE)

Replace whole :
Code:
C(MC_MATCH_CLAN_REQUEST_AGREED_CREATE_CLAN, "Match.Clan.RequestAgreedCreateClan", "Request Agreed Create Clan", MCDT_MACHINE2MACHINE)
			P(MPT_UID, "uidChar")	// ¿äûÇÑ Ä³¸¯ÅÍ UID
			P(MPT_STR, "ClanName")	// »ý¼ºÇÒ Å¬·£ À̸§
			P(MPT_STR, "Member1CharName")	// ¹ß±âÀΠij¸¯ÅÍ À̸§
		//	P(MPT_STR, "Member2CharName")	// ¹ß±âÀΠij¸¯ÅÍ À̸§
		//	P(MPT_STR, "Member3CharName")	// ¹ß±âÀΠij¸¯ÅÍ À̸§
		//	P(MPT_STR, "Member4CharName")	// ¹ß±âÀΠij¸¯ÅÍ À̸§



Gunz :-

ZPost.h:
FInd:
Code:
inline void ZPostRequestCreateClan(const MUID& uidChar, const int nRequestID, char* szClanName,

Replace whole :
Code:
inline void ZPostRequestCreateClan(const MUID& uidChar, const int nRequestID, char* szClanName,
								   char** ppMemberCharNames, int nMemberCharNamesCount)
{
	if (nMemberCharNamesCount != CLAN_SPONSORS_COUNT) return;
	ZPOSTCMD4(MC_MATCH_CLAN_REQUEST_CREATE_CLAN, MCmdParamUID(uidChar), MCmdParamInt(nRequestID), MCmdParamStr(szClanName), 
				MCmdParamStr(ppMemberCharNames[0]));

}



Database edits :

GunzDB -> Programability-> StoredProcedures ->

Find : spCreateClan :

Replace whole code :
Code:
USE [GunzDB]
GO
/****** Object:  StoredProcedure [dbo].[spCreateClan]    Script Date: 03/01/2013 10:15:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- Ŭ·£ »ý¼ºÇϱâ
ALTER PROC [dbo].[spCreateClan]
	@ClanName		varchar(24),
	@MasterCID		int,
	@Member1CID		int

AS
	DECLARE @NewCLID	int

	-- Ŭ·£À̸§ÀÌ Áߺ¹ÀÎÁö °Ë»çÇؾßÇÑ´Ù.
	SELECT @NewCLID=CLID FROM Clan(NOLOCK) WHERE Name=@ClanName

	IF @NewCLID IS NOT NULL
	BEGIN
		SELECT 0 AS Ret, 0 AS NewCLID
		RETURN
	END


	DECLARE @CNT		int

	-- Ŭ·£¿øÀÌ ¸ðµÎ °¡ÀÔ °¡´ÉÇÑÁö °Ë»çÇؾßÇÑ´Ù.
	SELECT @CNT = COUNT(*) FROM ClanMember cm(NOLOCK), Character c(NOLOCK) WHERE ((cm.CID=@MasterCID) OR (cm.CID=@Member1CID) ) AND cm.CID=c.CID AND c.DeleteFlag=0

	IF @CNT != 0
	BEGIN
		SELECT 0 AS Ret, 0 AS NewCLID
		RETURN
	END


	BEGIN TRAN
	-- Ŭ·£ »ý¼º
	INSERT INTO Clan (Name, MasterCID, RegDate) VALUES (@ClanName, @MasterCID, GETDATE())
	IF 0 <> @@ERROR BEGIN
		ROLLBACK TRAN
		SELECT 0 AS Ret, 0 AS NewCLID
		RETURN
	END

	SELECT @NewCLID = @@IDENTITY
	IF (@NewCLID IS not NULL)
	BEGIN
		DECLARE @Err1 int
		DECLARE @Err2 int
		DECLARE @Err3 int
		DECLARE @Err4 int
		DECLARE @Err5 int

		-- Ŭ·£¿ø °¡ÀÔ
		INSERT INTO ClanMember (CLID, CID, Grade, RegDate) VALUES (@NewCLID, @MasterCID, 1, GETDATE())
		SET @Err1 = @@ERROR		
		INSERT INTO ClanMember (CLID, CID, Grade, RegDate) VALUES (@NewCLID, @Member1CID, 9, GETDATE())
		SET @Err2 = @@ERROR
		

		IF (0 <> @Err1) OR (0 <> @Err2) BEGIN
			ROLLBACK TRAN
			SELECT 0 AS Ret, 0 AS NewCLID
			RETURN
		END
	END
	COMMIT TRAN

	-- ¸¶½ºÅÍ ¹Ù¿îƼ »èÁ¦
	--UPDATE Character SET BP=BP-1000 WHERE CID=@MasterCID


	SELECT 1 AS Ret, @NewCLID AS NewCLID


IF I MISS SOMETHING PLEASE FEEL FREE TO CORRECT, CAUSE M MESSED WITH SOURCE ATM.
Also idk this is release or tut, so mods check out.
Enjoy.
 
Last edited:
Experienced Elementalist
Joined
Feb 15, 2007
Messages
206
Reaction score
137
good job but i thought this was implemented in the igunz source
 
Initiate Mage
Joined
Apr 21, 2013
Messages
1
Reaction score
0
1) Creating clan with 2 players :-

CSCommon:

MAsyncDBJob.h :
Find
Code:
class MAsyncDBJob_CreateClan : public MAsyncJob {
Replace whole class :
Code:
////////////////////////////////////////////////////////////////////////////////////////////////////
class MAsyncDBJob_CreateClan : public MAsyncJob {
protected:
    MUID        m_uidMaster;
    MUID        m_uidMember1;
//    MUID        m_uidMember2;
//    MUID        m_uidMember3;
//    MUID        m_uidMember4;
protected: // Input Argument
    char        m_szClanName[256];
    int            m_nMasterCID;
    int            m_nMember1CID;
//    int            m_nMember2CID;
//    int            m_nMember3CID;
//    int            m_nMember4CID;
protected:    // Output Result
    bool        m_bDBResult;
    int            m_nNewCLID;
public:
    MAsyncDBJob_CreateClan(const MUID& uidOwne)    : MAsyncJob(MASYNCJOB_CREATECLAN, uidOwne) ,
                                              m_bDBResult(false), 
                                              m_nNewCLID(0)
    {
    
    }
    virtual ~MAsyncDBJob_CreateClan()    {}
    bool Input(const TCHAR* szClanName, 
               const int nMasterCID, 
               const int nMember1CID, 
    //           const int nMember2CID,
    //         const int nMember3CID, 
    //           const int nMember4CID,
               const MUID& uidMaster,
               const MUID& uidMember1);
    //           const MUID& uidMember2,
    //           const MUID& uidMember3,
    //           const MUID& uidMember4);
    virtual void Run(void* pContext);
    bool GetDBResult() { return m_bDBResult; }
    int GetNewCLID() { return m_nNewCLID; }
    const MUID& GetMasterUID() { return m_uidMaster; }
    const MUID& GetMember1UID() { return m_uidMember1; }
//    const MUID& GetMember2UID() { return m_uidMember2; }
//    const MUID& GetMember3UID() { return m_uidMember3; }
//    const MUID& GetMember4UID() { return m_uidMember4; }
    const char* GetClanName() { return m_szClanName; }
};
////////////////////////////


MMatchGlobal.h
Find :
Code:
#define CLAN_SPONSORS_COUNT            4        // Ŭ·£»ý¼º½Ã ÇÊ¿äÇÑ ¹ß±âÀÎ ¼ö

Change to :
Code:
#define CLAN_SPONSORS_COUNT            1        // Ŭ·£»ý¼º½Ã ÇÊ¿äÇÑ ¹ß±âÀÎ ¼ö

MMatchDBMgr.h
Find :
Code:
bool CreateClan(const TCHAR* szClanName, const int nMasterCID, const int nMember1CID, const int nMember2CID,
        const int nMember3CID, const int nMember4CID, bool* boutRet, int* noutNewCLID);

Replace :
Code:
bool CreateClan(const TCHAR* szClanName, const int nMasterCID, const int nMember1CID, bool* boutRet, int* noutNewCLID);


MAsyncDBJob.cpp
Find :
Code:
void MAsyncDBJob_CreateClan::Run(void* pContext)
Replace whole class:
Code:
/////////////////////////////////////////////////////////////////////////////////////////////////
void MAsyncDBJob_CreateClan::Run(void* pContext)
{
    MMatchDBMgr* pDBMgr = (MMatchDBMgr*)pContext;

    if (!pDBMgr->CreateClan(m_szClanName, 
                            m_nMasterCID, 
                            m_nMember1CID, 
    //                        m_nMember2CID, 
    //                        m_nMember3CID, 
    //                        m_nMember4CID, 
                            &m_bDBResult, 
                            &m_nNewCLID))
    {
        SetResult(MASYNC_RESULT_FAILED);

        return;
    }

    SetResult(MASYNC_RESULT_SUCCEED);
}

bool MAsyncDBJob_CreateClan::Input(const TCHAR* szClanName, 
                                    const int nMasterCID, 
                                    const int nMember1CID, 
                                //    const int nMember2CID,
                                //    const int nMember3CID, 
                            //        const int nMember4CID,
                                    const MUID& uidMaster,
                                    const MUID& uidMember1)
                            //        const MUID& uidMember2,
                            //        const MUID& uidMember3,
                            //        const MUID& uidMember4)
{
    strcpy(m_szClanName, szClanName);
    m_nMasterCID = nMasterCID;
    m_nMember1CID = nMember1CID;
//    m_nMember2CID = nMember2CID;
//  m_nMember3CID = nMember3CID;
//    m_nMember4CID = nMember4CID;

    m_uidMaster = uidMaster;
    m_uidMember1 = uidMember1;
//    m_uidMember2 = uidMember2;
//    m_uidMember3 = uidMember3;
//    m_uidMember4 = uidMember4;

    return true;
}

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


MMatchDBMgr.cpp
Find :
Code:
TCHAR g_szDB_CREATE_CLAN[] = _T("{CALL spCreateClan ('%s', %d, %d, %d, %d, %d)}");

Replace:
Code:
TCHAR g_szDB_CREATE_CLAN[] = _T("{CALL spCreateClan ('%s', %d, %d)}");



FIND :
Code:
bool MMatchDBMgr::CreateClan(const TCHAR* szClanName, const int nMasterCID, const int nMember1CID, const int nMember2CID,
                             const int nMember3CID, const int nMember4CID, bool* boutRet, int* noutNewCLID)

REPLACE whole case :
Code:
bool MMatchDBMgr::CreateClan(const TCHAR* szClanName, const int nMasterCID, const int nMember1CID, bool* boutRet, int* noutNewCLID)
{
    _STATUS_DB_START;
    if (!CheckOpen()) return false;



    CString strSQL;
    strSQL.Format(g_szDB_CREATE_CLAN, szClanName, nMasterCID, nMember1CID);

    CODBCRecordset rs(&m_DB);


    bool bException = false;
    try 
    {
        rs.Open(strSQL, CRecordset::forwardOnly, CRecordset::readOnly);
    } 
    catch(CDBException* e)
    {
        bException = true;

        ExceptionHandler(strSQL, e);
        return false;

        *boutRet = false;
        return false;
    }

    if ((rs.IsOpen() == FALSE) || (rs.GetRecordCount() <= 0) || (rs.IsBOF()==TRUE)) 
    {
        *boutRet = false;
        return false;
    }

    *boutRet = rs.Field("Ret").AsBool();
    *noutNewCLID = rs.Field("NewCLID").AsInt();


    _STATUS_DB_END(35);
    return true;


}


MMatchServer_Async.cpp

Find :
Code:
    _ASSERT(CLAN_SPONSORS_COUNT == 4);

    pSponsorObjects[0] = GetObject(pJob->GetMember1UID());
    pSponsorObjects[1] = GetObject(pJob->GetMember2UID());
    pSponsorObjects[2] = GetObject(pJob->GetMember3UID());
    pSponsorObjects[3] = GetObject(pJob->GetMember4UID());

Replace :
Code:
    _ASSERT(CLAN_SPONSORS_COUNT == 1);

    pSponsorObjects[0] = GetObject(pJob->GetMember1UID());
    //pSponsorObjects[1] = GetObject(pJob->GetMember2UID());
    //pSponsorObjects[2] = GetObject(pJob->GetMember3UID());
    //pSponsorObjects[3] = GetObject(pJob->GetMember4UID());

MMatchServer_Clan.cpp:

Find:
Code:
if (CLAN_SPONSORS_COUNT == 4)

Replace whole IF case :
Code:
if (CLAN_SPONSORS_COUNT == 1)
    {
        MAsyncDBJob_CreateClan* pNewJob = new MAsyncDBJob_CreateClan(uidPlayer);
        pNewJob->Input(szClanName, 
                       nMasterCID, 
                       nMemberCID[0], 
    //                   nMemberCID[1], 
    //                   nMemberCID[2], 
    //                   nMemberCID[3],
                       pMasterObject->GetUID(),
                       pSponsorObjects[0]->GetUID());
    //                   pSponsorObjects[1]->GetUID());
    //                   pSponsorObjects[2]->GetUID(),
    //                   pSponsorObjects[3]->GetUID());
        // PostAsyncJob(pNewJob);
        pMasterObject->m_DBJobQ.DBJobQ.push_back( pNewJob );
    }

MSharedCommandTable.cpp:
Find :
Code:
C(MC_MATCH_CLAN_REQUEST_AGREED_CREATE_CLAN, "Match.Clan.RequestAgreedCreateClan", "Request Agreed Create Clan", MCDT_MACHINE2MACHINE)

Replace whole :
Code:
C(MC_MATCH_CLAN_REQUEST_AGREED_CREATE_CLAN, "Match.Clan.RequestAgreedCreateClan", "Request Agreed Create Clan", MCDT_MACHINE2MACHINE)
            P(MPT_UID, "uidChar")    // ¿äûÇÑ Ä³¸¯ÅÍ UID
            P(MPT_STR, "ClanName")    // »ý¼ºÇÒ Å¬·£ À̸§
            P(MPT_STR, "Member1CharName")    // ¹ß±âÀΠij¸¯ÅÍ À̸§
        //    P(MPT_STR, "Member2CharName")    // ¹ß±âÀΠij¸¯ÅÍ À̸§
        //    P(MPT_STR, "Member3CharName")    // ¹ß±âÀΠij¸¯ÅÍ À̸§
        //    P(MPT_STR, "Member4CharName")    // ¹ß±âÀΠij¸¯ÅÍ À̸§



Gunz :-

ZPost.h:
FInd:
Code:
inline void ZPostRequestCreateClan(const MUID& uidChar, const int nRequestID, char* szClanName,

Replace whole :
Code:
inline void ZPostRequestCreateClan(const MUID& uidChar, const int nRequestID, char* szClanName,
                                   char** ppMemberCharNames, int nMemberCharNamesCount)
{
    if (nMemberCharNamesCount != CLAN_SPONSORS_COUNT) return;
    ZPOSTCMD4(MC_MATCH_CLAN_REQUEST_CREATE_CLAN, MCmdParamUID(uidChar), MCmdParamInt(nRequestID), MCmdParamStr(szClanName), 
                MCmdParamStr(ppMemberCharNames[0]));

}



Database edits :

GunzDB -> Programability-> StoredProcedures ->

Find : spCreateClan :

Replace whole code :
Code:
USE [GunzDB]
GO
/****** Object:  StoredProcedure [dbo].[spCreateClan]    Script Date: 03/01/2013 10:15:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- Ŭ·£ »ý¼ºÇϱâ
ALTER PROC [dbo].[spCreateClan]
    @ClanName        varchar(24),
    @MasterCID        int,
    @Member1CID        int

AS
    DECLARE @NewCLID    int

    -- Ŭ·£À̸§ÀÌ Áߺ¹ÀÎÁö °Ë»çÇؾßÇÑ´Ù.
    SELECT @NewCLID=CLID FROM Clan(NOLOCK) WHERE Name=@ClanName

    IF @NewCLID IS NOT NULL
    BEGIN
        SELECT 0 AS Ret, 0 AS NewCLID
        RETURN
    END


    DECLARE @CNT        int

    -- Ŭ·£¿øÀÌ ¸ðµÎ °¡ÀÔ °¡´ÉÇÑÁö °Ë»çÇؾßÇÑ´Ù.
    SELECT @CNT = COUNT(*) FROM ClanMember cm(NOLOCK), Character c(NOLOCK) WHERE ((cm.CID=@MasterCID) OR (cm.CID=@Member1CID) ) AND cm.CID=c.CID AND c.DeleteFlag=0

    IF @CNT != 0
    BEGIN
        SELECT 0 AS Ret, 0 AS NewCLID
        RETURN
    END


    BEGIN TRAN
    -- Ŭ·£ »ý¼º
    INSERT INTO Clan (Name, MasterCID, RegDate) VALUES (@ClanName, @MasterCID, GETDATE())
    IF 0 <> @@ERROR BEGIN
        ROLLBACK TRAN
        SELECT 0 AS Ret, 0 AS NewCLID
        RETURN
    END

    SELECT @NewCLID = @@IDENTITY
    IF (@NewCLID IS not NULL)
    BEGIN
        DECLARE @Err1 int
        DECLARE @Err2 int
        DECLARE @Err3 int
        DECLARE @Err4 int
        DECLARE @Err5 int

        -- Ŭ·£¿ø °¡ÀÔ
        INSERT INTO ClanMember (CLID, CID, Grade, RegDate) VALUES (@NewCLID, @MasterCID, 1, GETDATE())
        SET @Err1 = @@ERROR        
        INSERT INTO ClanMember (CLID, CID, Grade, RegDate) VALUES (@NewCLID, @Member1CID, 9, GETDATE())
        SET @Err2 = @@ERROR
        

        IF (0 <> @Err1) OR (0 <> @Err2) BEGIN
            ROLLBACK TRAN
            SELECT 0 AS Ret, 0 AS NewCLID
            RETURN
        END
    END
    COMMIT TRAN

    -- ¸¶½ºÅÍ ¹Ù¿îƼ »èÁ¦
    --UPDATE Character SET BP=BP-1000 WHERE CID=@MasterCID


    SELECT 1 AS Ret, @NewCLID AS NewCLID


IF I MISS SOMETHING PLEASE FEEL FREE TO CORRECT, CAUSE M MESSED WITH SOURCE ATM.
Also idk this is release or tut, so mods check out.
Enjoy.

Sorry for the trouble need help, add the code all well compiled and added to sql, but when sending the request clan does nothing, accepts a player, but does not send anything, could you help me?




 
Custom Title Activated
Loyal Member
Joined
Mar 24, 2011
Messages
1,632
Reaction score
145
so this code is not yet complete
 
Status
Not open for further replies.
Back
Top