Jump to content

Quest Function - Party Same IP - Check IP Match of Party Members


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

 

Hey, so i know it is not the best solution to prevent from players using multiple clients to get bosses drop, since low percent of players are playing from the same network(brothers for exmaple). Anyway,i think it is good enough for now. this quest function will check if there are party members with same IP  and return true/false

open questlua_party.cpp

Look for:

Spoiler

int party_get_member_pids(lua_State *L)

below this function add the following function:

Spoiler

int party_have_same_ip(lua_State* L)
    {
         CQuestManager & q = CQuestManager::instance();
        LPCHARACTER ch = q.GetCurrentCharacterPtr();
        LPPARTY pParty = ch->GetParty();
        if (NULL == pParty)
        {
            return 0;
        }
        
         FPartyPIDCollector f;
        pParty->ForEachOnMapMember(f, ch->GetMapIndex());
        
        for (std::vector <DWORD>::iterator it = f.vecPIDs.begin(); it != f.vecPIDs.end(); ++it)
        {
            LPCHARACTER ch1 = CHARACTER_MANAGER::instance().FindByPID(*it);
            
            for (std::vector <DWORD>::iterator it2 = f.vecPIDs.begin(); it2 != f.vecPIDs.end(); ++it2)
            {
                 LPCHARACTER ch2 = CHARACTER_MANAGER::instance().FindByPID(*it2);
                if (ch1->GetPlayerID() != ch2->GetPlayerID() && !(strcmp(ch1->GetDesc()->GetHostName(),ch2->GetDesc()->GetHostName())))
                {
                    lua_pushboolean(L, true);
                    return 1;
                }
                
            }
        
        
        }
        lua_pushboolean(L, false);
        return 0;
    }

 

search for:

Spoiler

{ "get_member_pids",        party_get_member_pids    },

add below:

Spoiler

{ "have_same_ip",                    party_have_same_ip},

 

add to questfunction the function: party.have_same_ip

example of a quest:

if party.have_same_ip() == true then
                say("2 or more members have same ip!")
            else
                say("all party members has different ip!")

 

enjoy :)

  • Metin2 Dev 3
  • Good 1
  • Love 4
Link to comment
Share on other sites

  • 5 months later...

questlua_party.cpp: In function 'int quest::party_have_same_ip(lua_State*)':
questlua_party.cpp:413: error: 'CHARACTER_MANAGER' has not been declared
questlua_party.cpp:417: error: 'CHARACTER_MANAGER' has not been declared
gmake: *** [Makefile:120: OBJDIR/questlua_party.o] Error 1

 

FIX: Add in quest questlua_party:

#include "char_manager.h"
Link to comment
Share on other sites

  • 1 year later...

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.