[CODE] Add y Delete GuildMaster

#1
--------------------
HGServer sources...
*--*-*-*-*-*--*-

Buscar /who y debajo agregar:

Code: Select all

if (memcmp(cp, "/addmaster ", 11) == 0) {
            PlayerCommandAddMaster(iClientH, cp, dwMsgSize - 21);
            return;
        }
Game.CPP (al final)

Code: Select all

void CGame::PlayerCommandAddMaster(int iClientH, char * pData, DWORD dwMsgSize)
{
 char   seps[] = "= \t\n";
 char   * token, cName[11], cTargetName[11], cBuff[256], cNpcName[21], cNpcWaypoint[11];
 class  CStrTok * pStrTok;
 register int i;

    if (m_pClientList[iClientH] == NULL) return;
    if ((dwMsgSize)    <= 0) return;

if (m_pClientList[iClientH]->m_iGuildRank != 0 ) {
        // ???? ??????? ?????* ?? ?????? ??????? ????.
        SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOGUILDMASTERLEVEL, NULL, NULL, NULL, NULL);
        return;
    }

    ZeroMemory(cName, sizeof(cName));
    ZeroMemory(cNpcWaypoint, sizeof(cNpcWaypoint));
    ZeroMemory(cTargetName, sizeof(cTargetName));
    ZeroMemory(cNpcName, sizeof(cNpcName));
    ZeroMemory(cBuff, sizeof(cBuff));
    memcpy(cBuff, pData, dwMsgSize);

    pStrTok = new class CStrTok(cBuff, seps);
    token = pStrTok->pGet();
    token = pStrTok->pGet();
       
    if (token != NULL) {
        // tokenÀÌ °ð äÆÃÀ» ºÒ°¡´ÉÇÏ°Ô ¸¸µé »ç¿ëÀÚ À̸§
        if (strlen(token) > 10)
             memcpy(cTargetName, token, 10);
        else memcpy(cTargetName, token, strlen(token));
             
        for (i = 1; i < DEF_MAXCLIENTS; i++)
        if ((m_pClientList[i] != NULL) && (memcmp(m_pClientList[i]->m_cCharName, cTargetName, 10) == 0)) {
            // ¸ñÇ¥ ij¸¯Å͸¦ ã¾Ò´Ù.     
            
            if (memcmp(m_pClientList[iClientH]->m_cGuildName, m_pClientList[i]->m_cGuildName, 20) != 0)  {
                // ????? ???????? ???? ?????? ????????.
                
                SendNotifyMsg(iClientH, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, "Error: Cannot Add Master...");
                delete pStrTok;
                return;
            }
m_pClientList[i]->m_iGuildRank = 0;
SendNotifyMsg(iClientH, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, "New Guild Master Added");
SendNotifyMsg(iClientH, i, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, "You are Now a GuildMaster");

                }

            delete pStrTok;
            return;
        }

        // ÇöÀç Á¢¼ÓÁßÀÌ ¾Æ´Ï´Ù.
        SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_PLAYERNOTONGAME, NULL, NULL, NULL, cTargetName);

    delete pStrTok;
    return;
}
Game.h

Code: Select all

    void PlayerCommandAddMaster(int iClientH, char * pData, DWORD dwMsgSize);
Code by: EvilHit ..

--

HgSources -> Game.cpp

buscamos /who y abajo agregamos:

Code: Select all

if (memcmp(cp, "/deletemaster ", 13) == 0) {
            PlayerOrder_DeleteGuildMaster(iClientH, cp, dwMsgSize - 21);
            return;
        }
al final del Game.cpp:

Code: Select all

void CGame::PlayerOrder_DeleteGuildMaster(int iClientH, char * pData, DWORD dwMsgSize)
{
 char   seps[] = "= \t\n";
 char   * token, cName[11], cTargetName[11], cBuff[256], cNpcName[21], cNpcWaypoint[11];
 class  CStrTok * pStrTok;
 register int i;

    if (m_pClientList[iClientH] == NULL) return;
    if ((dwMsgSize)    <= 0) return;

if (m_pClientList[iClientH]->m_iGuildRank != 0 ) {
        // ???? ??????? ?????* ?? ?????? ??????? ????.
        SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOGUILDMASTERLEVEL, NULL, NULL, NULL, NULL);
        return;
    }

    ZeroMemory(cName, sizeof(cName));
    ZeroMemory(cNpcWaypoint, sizeof(cNpcWaypoint));
    ZeroMemory(cTargetName, sizeof(cTargetName));
    ZeroMemory(cNpcName, sizeof(cNpcName));
    ZeroMemory(cBuff, sizeof(cBuff));
    memcpy(cBuff, pData, dwMsgSize);

    pStrTok = new class CStrTok(cBuff, seps);
    token = pStrTok->pGet();
    token = pStrTok->pGet();
       
    if (token != NULL) {
        // token?€?Œ °ð ?ƒ¤?†?ƒ?€» º?’°¡´?‰?‡Ï°?” ¸¸µé »ç¿ë?€?š ?€?Œ¸§
        if (strlen(token) > 10)
             memcpy(cTargetName, token, 10);
        else memcpy(cTargetName, token, strlen(token));
             
        for (i = 1; i < DEF_MAXCLIENTS; i++)
        if ((m_pClientList[i] != NULL) && (memcmp(m_pClientList[i]->m_cCharName, cTargetName, 10) == 0)) {
            // ¸ñ?‡¥ ?„³¸¯?…͸¦ ?ƒ£¾?’´?™.     
            
            if (memcmp(m_pClientList[iClientH]->m_cGuildName, m_pClientList[i]->m_cGuildName, 20) != 0)  {
                // ????? ???????? ???? ?????? ????????.
                
                SendNotifyMsg(iClientH, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, "Error: No se puede borrar el GuildMaster.");
                delete pStrTok;
                return;
            }
m_pClientList[i]->m_iGuildRank = 12;
SendNotifyMsg(iClientH, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, "El GuildMaster fue borrado.");
SendNotifyMsg(iClientH, i, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, "Ya no eres GuildMaster.");

                }

            delete pStrTok;
            return;
        }

        // ?‡ö?€ç Á¢¼?“Á?Ÿ?€?Œ ¾?†´Ï´?™.
        SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_PLAYERNOTONGAME, NULL, NULL, NULL, cTargetName);

    delete pStrTok;
    return;
}
Game.h:

Code: Select all

void PlayerOrder_DeleteGuildMaster(int iClientH, char * pData, DWORD dwMsgSize);
Code by EvilHit... traducido y modificado por juan249 :P
Centuu.-

Sol Lucet Omnibus.-

Who is online

Users browsing this forum: No registered users and 1 guest

cron