Jump to content

Mali

Honorable Member
  • Posts

    918
  • Joined

  • Days Won

    877
  • Feedback

    100%

Posts posted by Mali

  1. c++ version

    #include <iostream>
    #include <ctime>
    using namespace std;
    int main()
    {
        srand( time( NULL ) );
        char list[] = {"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y"};
        int maxStr = 10;
        std::string random_word = "";
        for (int i = 0; i < maxStr; ++i) {
            int randa = rand() % sizeof(list);
            if (list[randa] == ',') {
                i--;
                continue;
            }
            random_word += list[randa];
        }
        cout<<random_word;
    
        return 0;
    }

     

  2. Thanks bro but this part is wrong

    if (stch)
    		{
    			.....
    			....
    			stch->ChatPacket(CHAT_TYPE_WHISPER, "%s: %s", ch->GetName(), message.c_str());
    			ch->ChatPacket(CHAT_TYPE_WHISPER, "To %s: %s", stch->GetName(), message.c_str());
    			....	
    		}
    		else if (stch == ch)

    You can use this:

    		if (stch)
    		{
    			if (stch == ch)
    				bla bla
    			.....
    			....
    			stch->ChatPacket(CHAT_TYPE_WHISPER, "%s: %s", ch->GetName(), message.c_str());
    			ch->ChatPacket(CHAT_TYPE_WHISPER, "To %s: %s", stch->GetName(), message.c_str());
    			....	
    		}

     

  3. 19 minutes ago, Tasho said:

    That's why metin2 is cancerous community..we stole code/ideas from another guys and put inside without any mention or thanks for it, doesn't importantly if you post free or not.

    1.

      Reveal hidden contents
    
    
    void CTournamentPvP::Destroy()
    {
    	ClearSTDMap();
    	if (running_event != NULL)
    	{
    		event_cancel(&running_event);
    		running_event = NULL;
    	}
    }
    
    void DestroyAutoNotice()
    {
    	message_data.clear();
    	if (running_event != NULL)
    	{
    		event_cancel(&running_event);
    		running_event = NULL;
    	}
    }

     

    2.

      Reveal hidden contents
    
    
    bool CTournamentPvP::Initialize()
    {
    	if (running_event != NULL)
    	{
    		event_cancel(&running_event);
    		running_event = NULL;
    	}
    
    	TournamentPvPInfoData* info = AllocEventInfo<TournamentPvPInfoData>();
    	info->pTournament = this;
    	running_event = event_create(tournament_timer, info, PASSES_PER_SEC(30));
    }
    
    void InitAutoNotice()
    {
    	if (running_event != NULL)
    	{
    		event_cancel(&running_event);
    		running_event = NULL;
    	}
    
    	AutoNoticeInfoData* info = AllocEventInfo<AutoNoticeInfoData>();
    	running_event = event_create(automatic_event_timer, info, PASSES_PER_SEC(1));
    }

     

    3.

      Reveal hidden contents
    
    
    void CheckAutoNotice()
    {
    	time_t cur_Time = time(NULL);
    	struct tm vKey = *localtime(&cur_Time);
    }
    
    void CTournamentPvP::PrepareAnnouncement()
    {
    	time_t cur_Time = time(NULL);
    	struct tm vKey = *localtime(&cur_Time);
    }

     

    There are more..

    You know very well about what i'm talking, already there exist more guys which take system a, b from C and make some changes and adapt it for another things.
    I don't will talk about the rest of code which is already non-sense, already all people can see it. 
    Look:

    Already you and this guy stole the same concept of call event and check real time from Tournament PvP and do some changes, great coders.

    Good luck "Developer of future."

    Cry bitch

  4.  

    Spoiler

    //syntax:
    #NewNotice        
    # message    yourmessage(._.->space)
    # message    secondmessage(._.->space)
    # gmlvl    GM_LEVEL(0-5)
    # minlvl    minumumlevel
    # maxlvl    maximumlevel
    # mapidx    forkedmapindex    
    # mapidx    forkedmapindex    
    # chat_type    Chat Type(0-4)
    # day_type    Day Type(0-1) 0->Month Days(0-31), 1->Week Days(0-6)
    # date    Day    
    # hour    Hour    
    # min    Minute    
    # end

    //Note: if you remove day, message will repeat everyday
    //Note2: if you remove hour, message will repeat everyhour
    //Note3: you can remove mapidx for everymap
    //Note4: if you remove(chat_type, day_type, minlvl, maxlvl, gmlvl) system will reset default values
    //Note5: you can add as many (messages, date, hour, min, mapidx) as you want

     

     

    This is the hidden content, please

    • Metin2 Dev 4
    • Love 5
  5. On 28.02.2018 at 4:23 PM, Dobrescu Sebastian said:
    
    void MessengerManager::RemoveFromBlockList(MessengerManager::keyA account, MessengerManager::keyA companion)

    You have to escape it. Haven't you learned anything from the past sql exploit ?

     

     

    No, whatever

    You know that bug fixed, you can fix like the messenger

  6. 2 minutes ago, hachiwari said:

     

    
    	std::string NumberToMoneyString(long long n)
    {
        std::string s;
        int cnt = 0;
        do
        {
            s.insert(0, 1, char('0' + n % 10));
            n /= 10;
    	        if (++cnt == 3 && n)
            {
                s.insert(0, 1, '.');
                cnt = 0;
            }
        } while (n);
    	    return s;
    }
    	

     

    whose better?

    My codes better, you can use with int and char. Also shorter than this

    • Love 1
  7. You can use like this:
     

    Spoiler

     

    NUMBER_TEXT("123456789")

    NUMBER_TEXT_INT(123456789)

     

    Locale.hpp add;

    	const char *locale_number(const char *string);
    	const char *locale_number2(unsigned int mynumber);
    #define NUMBER_TEXT(str) locale_number(str)
    #define NUMBER_TEXT_INT(str) locale_number2(str)

    Locale.cpp add;

    #include <sstream>
    #include <string.h>
    using namespace std;
    const char * locale_number(const char *string2)
    {
    	string str = string2; auto len = str.length(); auto counter = 2;
    	while (counter < len) { if (counter % 3 == 0) str.insert(len - counter, ".");
    		++counter;
    	}
    	return str.c_str();
    }
    const char * locale_number2(unsigned int mynumber)
    {
    	stringstream strr; strr << mynumber;
    	return locale_number(strr.str().c_str());
    }

    TEST IN SERVER:

    	auto gold = 10;
    	ChatPacket(CHAT_TYPE_INFO, "We are testing(NUMBER_TEXT): %s", NUMBER_TEXT("123456789"));
    	for (auto i : {10, 100, 1000, 10000, 500000}) {
    		ch->ChatPacket(CHAT_TYPE_INFO, "We are testing(NUMBER_TEXT_INT): %s(i:%d)", NUMBER_TEXT_INT(gold*i), i);
    	}

    TEST:

    #include <iostream>
    #include <string.h>
    using namespace std;
    #define NUMBER_TEXT(str) locale_number(str)
    #define NUMBER_TEXT_INT(str) locale_number2(str)
    const char *locale_number(const char *string);
    const char *locale_number2(int mynumber);
    const char * locale_number(const char *string2)
    {
    	string str = string2;
    	auto len = str.length();
    	auto counter = 2;
    	///////
    	while (counter < len) { if (counter % 3 == 0) str.insert(len - counter, ".");
    		++counter;
    	}
    	return str.c_str();
    }
    const char * locale_number2(int mynumber)
    {
    	auto str = std::to_string(mynumber);
    	return locale_number(str.c_str());
    }
    
    int main ()
    {
        auto gold = 10;
    	for (auto i: {10, 100, 1000, 10000, 500000}) {
    		cout << NUMBER_TEXT_INT(gold*i) << endl;
    	}
    	return 0;
    }

    Test result: EPRV2z.jpg

    • Love 1
  8. On 31.10.2017 at 8:33 PM, metin2-factory said:

    Small update #2

    If you have installed my official like new elemental bonuses. follow the small guide below to view element icon of a target that wears

    the new rings, like in official.

    CxLhHukNSNe0fnTg7Ks24w.png

     

    open char.cpp,look for: 

    
    #ifdef ELEMENT_TARGET

    replace the entire content of the #ifdef, until the #endif with the following:

    
    #ifdef ELEMENT_TARGET
    	p.bElement = 0;
    	BYTE elementBase = 0;
    	DWORD raceFlag;
    	if (m_pkChrTarget)
    	{
    		if (m_pkChrTarget->IsMonster() && (raceFlag = m_pkChrTarget->GetMobTable().dwRaceFlag) >= RACE_FLAG_ATT_ELEC)
    		{
    			for (int i = RACE_FLAG_ATT_ELEC; i > 1; i /= 2)
    			{
    				elementBase++;
    			}
    			DWORD curElementBase = elementBase;
    			const int ELEMENT_BASE_FLAG = pow(2, elementBase);
    			for (int i = RACE_FLAG_ATT_ELEC; i <= RACE_FLAG_ATT_DARK; i *= 2)
    			{
    				curElementBase++;
    				int diff = raceFlag - i;
    				if (abs(diff) < ELEMENT_BASE_FLAG)
    					break;
    			}
    			p.bElement = curElementBase - elementBase;
    		}
    		else if (m_pkChrTarget->IsPC())
    		{
    			LPITEM pItem = m_pkChrTarget->GetWear(WEAR_RING1);
    			if (pItem)
    			{
    				const int BASE_ELEMENT = APPLY_ATTBONUS_ELEC;
    				for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++)
    				{
    					if (pItem->GetNewAttributeType(i) >= APPLY_ATTBONUS_ELEC && pItem->GetSocket(i) <= APPLY_ATTBONUS_DARK)
    					{
    						p.bElement = pItem->GetNewAttributeType(i) - BASE_ELEMENT + 1;
    						break;
    					}
    				}
    			}
    		}
    	}
    
    #endif

     

    Compile server and that's it. now, when you select a target that wear a ring with elemental bonuses, an element icon will appear next to the target.

    You can't use pow without float 

    const int ELEMENT_BASE_FLAG = pow((float)2, elementBase);

    And why do you don't use ARMOR_PENDANT anyway thanks :)

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