Jump to content

Ulas

Active Member
  • Posts

    73
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by Ulas

  1. On 4/5/2023 at 10:28 PM, Distraught said:
    This is the hidden content, please

     

    Hello everyone,

    Some time ago I created this memory leak finder for Land of Heroes, but we don't really use it anymore so I decided to release it.

    You can use it only on Windows (otherwise you have to modify it a bit), and you will need

    This is the hidden content, please
    for it to work.

    namespace MemoryLeakFinder
    {
    	typedef void* (__cdecl* _malloc)(_In_ _CRT_GUARDOVERFLOW size_t _Size);
    	typedef void (__cdecl* _free)(_Pre_maybenull_ _Post_invalid_ void* _Block);
    
    	_malloc True_malloc = (_malloc) ::malloc;
    	_free True_free = (_free) ::free;
    
    	template <class T>
    	class NoTraceAllocator
    	{
    	public:
    		using value_type = T;
    		NoTraceAllocator() noexcept {}
    		template <class U> NoTraceAllocator(NoTraceAllocator<U> const&) noexcept {}
    		value_type* allocate(std::size_t n)
    		{
    			return static_cast<value_type*>(True_malloc(n * sizeof(value_type)));
    		}
    		void deallocate(value_type* p, std::size_t) noexcept
    		{
    			True_free(p);
    		}
    	};
    
    	static bool GetStackWalk(char* outWalk)
    	{
    		::SymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_INCLUDE_32BIT_MODULES | SYMOPT_UNDNAME);
    		if (!::SymInitialize(::GetCurrentProcess(), "http://msdl.microsoft.com/download/symbols", TRUE))
    			return false;
    		PVOID addrs[25] = { 0 };
    		USHORT frames = CaptureStackBackTrace(1, 25, addrs, NULL);
    
    		char* ptr = outWalk;
    		for (USHORT i = 0; i < frames; i++)
    		{
    			ULONG64 buffer[(sizeof(SYMBOL_INFO) + 1024 + sizeof(ULONG64) - 1) / sizeof(ULONG64)] = { 0 };
    			SYMBOL_INFO* info = (SYMBOL_INFO*)buffer;
    			info->SizeOfStruct = sizeof(SYMBOL_INFO);
    			info->MaxNameLen = 1024;
    			DWORD64 displacement = 0;
    			if (::SymFromAddr(::GetCurrentProcess(), (DWORD64)addrs[i], &displacement, info)) 
    			{
    				ptr += sprintf_s(outWalk, 1024, "%s\n", info->Name);
    			}
    		}
    		::SymCleanup(::GetCurrentProcess());
    		return true;
    	}
    
    	std::unordered_map<void*, const char*
    		, std::hash<void*>
    		, std::equal_to<void*>
    		, NoTraceAllocator<std::pair<const void*, const char*>>> memoryAllocations;
    
    	void* My_malloc(_In_ _CRT_GUARDOVERFLOW size_t _Size)
    	{
    		void* ptr = True_malloc(_Size);
    		char* stackTrace = (char*)True_malloc(1024);
    		GetStackWalk(stackTrace);
    		memoryAllocations.emplace(std::make_pair(ptr, stackTrace));
    		return ptr;
    	}
    	void My_free(_Pre_maybenull_ _Post_invalid_ void* _Block)
    	{
    		auto it = memoryAllocations.find(_Block);
    		if (it != memoryAllocations.end())
    		{
    			True_free((void*)it->second);
    			memoryAllocations.erase(it);
    		}
    		return True_free(_Block);
    	}
    
    	void StartMemoryLeakFinder()
    	{
    		Mhook_SetHook((PVOID*)&True_malloc,
    			My_malloc);
    		Mhook_SetHook((PVOID*)&True_free,
    			My_free);
    	}
    
    	void StopMemoryLeakFinder()
    	{
    		Mhook_Unhook((PVOID*)&True_malloc);
    		Mhook_Unhook((PVOID*)&True_free);
    
    		std::ofstream ofs("memoryleaks.txt");
    		for (auto it = memoryAllocations.begin(); it != memoryAllocations.end(); ++it)
    		{
    			ofs << it->second << std::endl;
    			True_free((void*)it->second);
    		}
    		ofs.close();
    	}
    }

     

    You have to call StartMemoryLeakFinder() and StopMemoryLeakFinder() where you'd like them to start and stop accordingly.

    Can you update to VC140 please

    • Metin2 Dev 2
  2. 37 minutes ago, ugm2 said:

    Thanks for that, everything is working perfectly so far 🙂

    But I have a short question: Is it possible to run a Hamachi server with these server files ? 
    Yes I know, "get a root for a few € and you're done", but I have tons of hardware lying around here, so why rent/buy something extra;)

    I have tried to collect / search info about it, but I only find old stuff that doesn't work anymore or is already 10-14 years old.

    Thanks in advance 🙂

    (Oh and before anyone asks, it is only intended for 2-3 people, so a root is simply not worth it)

    Open port  and change ip router port and have a good fun 🙂

  3. On 7/20/2021 at 6:13 PM, TMP4 said:
    This is the hidden content, please

    Updated at 2023.08.05.

    Alternative download links:
     

    This is the hidden content, please
     + 
    This is the hidden content, please
     +
    This is the hidden content, please

    [40250] Reference Serverfile + Client + Src [15 Available Languages]

    My goal was to make a reference r40250 serverfile as official as possible compared to what GF had back when their files got leaked in early 2014.
    No new systems added, only bug fixes. While I spent several hours testing, there may still be bugs. Please report bugs to me so I can fix them in the
    future, I want to make this project as bug free as possible.

    Available languages: EN/DE/HU/FR/CZ/DK/ES/GR/IT/NL/PL/PT/RO/RU/TR
    Please read Languages.txt to learn how to change the default EN language.

    SSH for VM: root/123456789
    MySQL: root/123456789
    Ingame: admin/123456789

    Aliases and it's commands:

    start			cd /usr/metin2/server && sh start.sh
    close			cd /usr/metin2/server && sh close.sh
    clean			cd /usr/metin2/server && sh clean.sh
    backup			cd /usr/metin2/server && sh backup.sh
    questcompile		cd /usr/metin2/server/share/locale/english/quest && python2.7 make.py
    dbclean			cd /usr/metin2/src/server/db/src && gmake clean
    dbdep			cd /usr/metin2/src/server/db/src && gmake dep
    dbcompile		cd /usr/metin2/src/server/db/src && gmake -j9
    gameclean		cd /usr/metin2/src/server/game/src && gmake clean
    gamedep			cd /usr/metin2/src/server/game/src && gmake dep
    gamecompile		cd /usr/metin2/src/server/game/src && gmake -j9

    Please read Changelog.txt to find more about the changes I made.

    Special thanks to:

    @Mali for the clean and updated client & server src files.
    @Sanchez for the 2014 base client.
    @Veltor88 for the translate.lua pack.
    @Fazer for the locale_string pack

    I made a little video about installing the serverfile (vm) and changing the language:

      Reveal hidden contents

    Video reupload: 

    This is the hidden content, please

    PS: I know it's pretty late in 2021 but better than ever 😀

    Sincerely,
    TMP4

    Do you have x64 libs?

    • Metin2 Dev 1
    • Love 1
  4. On 4/13/2023 at 11:28 PM, Powell said:

    Description of the problem: If you press the [Space key] while you are riding, while there is no weapon in your hand, it gives an error like this and keeps a syserr record every second.

    How to fix: If you want to fix that problem you will be find on your client source folder in this file ActorInstanceBattle.cpp.

     

    Client Source>GameLib>ActorInstanceBattle.cpp

     

    Find:

        if (wComboIndex == 0)
        {
            TraceError("CActorInstance::__RunNextCombo(wComboType=%d, wComboIndex=%d)", wComboType, wComboIndex);
            return;
        }

    Add under:

        else if (m_wcurMotionMode == 9)
        {
            return;
        }

    That is all.

    I think this is not fix but this is your chooice 🙂

    • Metin2 Dev 1
  5. 6 hours ago, Henry6767 said:

    After game dep, I typed gmake clean and then gmake -j9. It started to compile but at the end I go these error messages

     

    linking ../db....
    ld: error: undefined symbol: ZSTD_freeCCtx
    >>> referenced by my_compress.cc
    >>>               my_compress.cc.o:(mysql_compress_context_deinit(mysql_compress_context*)) in archive /usr/local/lib/mysql/libmysqlclient.a

    ld: error: undefined symbol: ZSTD_freeDCtx
    >>> referenced by my_compress.cc
    >>>               my_compress.cc.o:(mysql_compress_context_deinit(mysql_compress_context*)) in archive /usr/local/lib/mysql/libmysqlclient.a

    ld: error: undefined symbol: ZSTD_createCCtx
    >>> referenced by my_compress.cc
    >>>               my_compress.cc.o:(zstd_compress_alloc(mysql_zstd_compress_context*, unsigned char const*, unsigned int*, unsigned int*)) in archive /usr/local/lib/mysql/libmysqlclient.a

    ld: error: undefined symbol: ZSTD_compressBound
    >>> referenced by my_compress.cc
    >>>               my_compress.cc.o:(zstd_compress_alloc(mysql_zstd_compress_context*, unsigned char const*, unsigned int*, unsigned int*)) in archive /usr/local/lib/mysql/libmysqlclient.a

    ld: error: undefined symbol: ZSTD_compressCCtx
    >>> referenced by my_compress.cc
    >>>               my_compress.cc.o:(zstd_compress_alloc(mysql_zstd_compress_context*, unsigned char const*, unsigned int*, unsigned int*)) in archive /usr/local/lib/mysql/libmysqlclient.a

    ld: error: undefined symbol: ZSTD_isError
    >>> referenced by my_compress.cc
    >>>               my_compress.cc.o:(zstd_compress_alloc(mysql_zstd_compress_context*, unsigned char const*, unsigned int*, unsigned int*)) in archive /usr/local/lib/mysql/libmysqlclient.a
    >>> referenced by my_compress.cc
    >>>               my_compress.cc.o:(my_uncompress(mysql_compress_context*, unsigned char*, unsigned int, unsigned int*)) in archive /usr/local/lib/mysql/libmysqlclient.a

    ld: error: undefined symbol: ZSTD_createDCtx
    >>> referenced by my_compress.cc
    >>>               my_compress.cc.o:(my_uncompress(mysql_compress_context*, unsigned char*, unsigned int, unsigned int*)) in archive /usr/local/lib/mysql/libmysqlclient.a

    ld: error: undefined symbol: ZSTD_decompressDCtx
    >>> referenced by my_compress.cc
    >>>               my_compress.cc.o:(my_uncompress(mysql_compress_context*, unsigned char*, unsigned int, unsigned int*)) in archive /usr/local/lib/mysql/libmysqlclient.a
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    gmake: *** [Makefile:50: ../db] Error 1

    How should I fix these?

    Can you add me Ulas#8871  I can check your bsd

  6. 3 hours ago, Henry6767 said:

    Hi. When I tried to recompile db I did these commands and I got this error. I tried downloading the typelib.h from the internet but then I got another message with another file missing. 

    What should I do in this situation?

    Any help would be greatly appreciated!

     

    Error message:

    root@:~ # cd /usr/metin2/src/server/db/src
    root@:/usr/metin2/src/server/db/src # gmake clean
    root@:/usr/metin2/src/server/db/src # gmake -j9
    compile Config.cpp
    gmake: *** No rule to make target '/usr/local/include/mysql/typelib.h', needed by '.obj/NetBase.o'.  Stop.
    gmake: *** Waiting for unfinished jobs....

    gmake dep

    and try again

    • Love 1
  7. 5 minutes ago, ionutsebastian said:

    Hello, i am a beginner and i start to learn to compliance the sources but  I ran into this error and i don't know how to fix this.

     

    root@Clever-Host:/usr/src/Source/Server/game/src # gmake clean
    root@Clever-Host:/usr/src/Source/Server/game/src # gmake -j20
    compiling BattleArena.cpp  [OK]
    compiling FSM.cpp  [OK]
    gmake: clang++-devel: No such file or directory
    compiling MarkConvert.cpp  [OK]
    gmake: *** [Makefile:116: .obj/FSM.o] Error 127
    gmake: *** Waiting for unfinished jobs....
    gmake: clang++-devel: No such file or directory
    gmake: *** [Makefile:116: .obj/MarkConvert.o] Error 127
    gmake: clang++-devel: No such file or directory
    gmake: *** [Makefile:116: .obj/BattleArena.o] Error 127
    compiling MarkImage.cpp  [OK]
    gmake: clang++-devel: No such file or directory
    gmake: *** [Makefile:116: .obj/MarkImage.o] Error 127
     

    pkg install llvm-devel

  8. This is the hidden content, please

     

    What is Vrunner?

    • After Creating a Backup of Your Vrunner Channel Core File as a Pid
    • Automatic Within Seconds If Ch Shuts Off For Any Reason
    • It is a reopening system. Players Feel The Fall As Dc.
    • Ch drops even on server using %0 Syser. So why?
    • After 1 day 2 days 7 days after Ram Cache is Full, Ch Drops.
    • You won't have such a problem with Vrunner.
    • Some of the High Online Servers Use This Method.

    Download

    • Metin2 Dev 84
    • kekw 1
    • Angry 1
    • Think 6
    • Good 24
    • Love 5
    • Love 29
  9. 3 hours ago, TMP4 said:

    The close.sh what calls the shut.shs in the cores what reads pid files for checking the needed pid to kill is original code. I think Ymir made this because they run multiple metin2 servers in one machine and killall game db would kill every server.

    Only problem with the original way if someone runs a clean.sh that deletes the pid file.. 😄 So close.sh will not work and they have to stop the server in another way (like killall game db in console). Excluding pid files from clean.sh can solve this problem.

    While yes if you have 1 server on the machine killall game db works fine, but I keep it original.

    or add mysql user 127.0.0.1 and try again or change makefile in 127.0.0.1 -> localhost

    • Good 1
  10. On 12/15/2022 at 10:47 PM, Filiq said:

    i'm trying for some hours to put the serverfile on a server, and i just get socket_connect: HOST 127.0.0.1:15000, could not connect. i changed ips, ports nothing.. dosen't work anything 

    syserr db
     

    SYSERR: Dec 15 21:43:16 :: Start: TABLE_POSTFIX not configured use default
    SYSERR: Dec 15 21:43:54 :: pid_init: 
    Start of pid: 2080
    

     

    Don't need sql_mode

    Change
    size(enum) -> size(Set)

    Change
    setRaceFlag

    Change in MySQL value

    setRaceFlag 'ANIMAL','UNDEAD','DEVIL','HUMAN','ORC','MILGYO','INSECT','FIRE','ICE','DESERT','TREE','ATT_ELEC','ATT_FIRE','ATT_ICE','ATT_WIND','ATT_EARTH','ATT_DARK'

     

    5 hours ago, Pseudabo said:

    I already shared this in topic..

    Btw. You must change dump proto too, not only source..

    Thx I don't saw 

  11. Admin shop opened with 71049(silk bundle)
    Test account normal with packet but doestnt work

     

    
    void CClientManager::MyshopPricelistUpdate(const TItemPriceListTable* pPacket)
    {
        if (pPacket->byCount > SHOP_PRICELIST_MAX_NUM)
        {
            sys_err("count overflow!");
            return;
        }
    
        CItemPriceListTableCache* pCache = GetItemPriceListCache(pPacket->dwOwnerID);
    
        if (pCache)
        {
            TItemPriceListTable table;
    
            table.dwOwnerID = pPacket->dwOwnerID;
            table.byCount = pPacket->byCount;
    
            thecore_memcpy(table.aPriceInfo, pPacket->aPriceInfo, sizeof(TItemPriceInfo) * pPacket->byCount);
    
            pCache->UpdateList(&table);
        }
        else
        {
            TItemPriceListTable* pUpdateTable = new TItemPriceListTable;
    
            pUpdateTable->dwOwnerID = pPacket->dwOwnerID;
            pUpdateTable->byCount = pPacket->byCount;
    
            thecore_memcpy(pUpdateTable->aPriceInfo, pPacket->aPriceInfo, sizeof(TItemPriceInfo) * pPacket->byCount);
    
            char szQuery[QUERY_MAX_LEN];
            snprintf(szQuery, sizeof(szQuery), "SELECT item_vnum, price FROM myshop_pricelist%s WHERE owner_id=%u", GetTablePostfix(), pPacket->dwOwnerID);
            CDBManager::instance().ReturnQuery(szQuery, QID_ITEMPRICE_LOAD_FOR_UPDATE, 0, pUpdateTable);
        }
    }

    Proof screenshot

  12. On 12/20/2022 at 4:00 PM, Trial said:

    Hello,

    So I have shared this fix with someone a few days ago and saw this morning that martysama has published it on it's blog.
    I let you know before kids with "private" access to this start playing with it. (I do not have acces to martysama's blog member posts and do not know who does)

    The "pc_change_name" function has an exploitable item duplication bug.

    The fix is simple, in "pc_change_name" replace this code:

    db_clientdesc->DBPacketHeader(HEADER_GD_FLUSH_CACHE, 0, sizeof(DWORD));
    db_clientdesc->Packet(&pid, sizeof(DWORD));

    with this:

    if (!CHARACTER_MANAGER::instance().FlushDelayedSave(ch))
    {
        ch->SaveReal();
    }

     

    I will edit this post to add details on how and why later on to avoid kids playing with it before it's patched on majority of servers.

     

    Regards,

    Can you add proof please. I want show problem.

  13. I do what he did when he unblocked, but unfortunately, even though I delete it from sql, the ban remains active in the game.
    https://www.youtube.com/watch?v=0XZqc0tky0o

    Maybe this thing problem
     

        if (g_bAuthServer)
        {
            hwid_manager.InitializeBlocked();
        }
    
    #include "stdafx.h"
    #include "../../common/length.h"
    
    #include "hwidmanager.h"
    #include "config.h"
    #include "db.h"
    #include "packet.h"
    #include "desc_client.h"
    
    CHwidManager::CHwidManager()
    {
    	
    }
    
    CHwidManager::~CHwidManager()
    {
    	m_blocked_hwid.clear();
    }
    
    void CHwidManager::CleanBlocked()
    {
    	m_blocked_hwid.clear();
    }
    
    void CHwidManager::InitializeBlocked()
    {
    	CleanBlocked();
    
    	std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery("SELECT hwid FROM account.blocked_hwids"));
    	if (msg->Get()->uiNumRows > 0) {
    		MYSQL_ROW row;
    		while ((row = mysql_fetch_row(msg->Get()->pSQLResult))) {
    			char hwid[HWID_LENGTH];
    			strlcpy(hwid, row[0], sizeof(hwid));
    			if (std::find(m_blocked_hwid.begin(), m_blocked_hwid.end(), hwid) == m_blocked_hwid.end()) {
    				m_blocked_hwid.push_back(hwid);
    			}
    		}
    	}
    }
    
    bool CHwidManager::IsBlocked(const char * hwid)
    {
    	return std::find(m_blocked_hwid.begin(), m_blocked_hwid.end(), hwid) != m_blocked_hwid.end();
    }
    
    void CHwidManager::AddHwidToAccount(const char * login, const char * hwid) {
    	std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery("UPDATE account.account SET status='BAN2', hwid='%s' WHERE login='%s' and STATUS='OK'", hwid, login));
    }
    
    void CHwidManager::SendBlockHwid(const char * whoname, const char * targetname)
    {
    	THwidRequest pack;
    	strlcpy(pack.whoname, whoname, sizeof(pack.whoname));
    	strlcpy(pack.targetname, targetname, sizeof(pack.targetname));
    
    	db_clientdesc->DBPacket(HEADER_GD_BLOCKHWID, 0, &pack, sizeof(pack));
    }
    
    void CHwidManager::RecvBlockHwid(const char * whoname, const char * targetname)
    {
    	if (!g_bAuthServer) {
    		return;
    	}
    
    	char whoplayername[CHARACTER_NAME_MAX_LEN * 2 + 1];
    	DBManager::instance().EscapeString(whoplayername, sizeof(whoplayername), whoname, strlen(whoname));
    
    	char playername[CHARACTER_NAME_MAX_LEN * 2 + 1];
    	DBManager::instance().EscapeString(playername, sizeof(playername), targetname, strlen(targetname));
    
    	std::unique_ptr<SQLMsg> check(DBManager::instance().DirectQuery("SELECT mID FROM common.gmlist WHERE mName='%s' AND mAuthority='IMPLEMENTOR' LIMIT 1", playername));
    	if (check->Get()->uiNumRows > 0) {
    		sys_log(0, "HWID:: %s tried to block %s (IMPLEMENTOR).", whoplayername, playername);
    		return;
    	}
    
    	std::unique_ptr<SQLMsg> msgid(DBManager::instance().DirectQuery("SELECT account_id FROM player.player WHERE name='%s' LIMIT 1", playername));
    	if (msgid->Get()->uiNumRows > 0) {
    		MYSQL_ROW rowid = mysql_fetch_row(msgid->Get()->pSQLResult);
    
    		std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery("SELECT hwid FROM player.player_index WHERE id=%d LIMIT 1", atoi(rowid[0])));
    		if (msg->Get()->uiNumRows > 0) {
    			MYSQL_ROW row = mysql_fetch_row(msg->Get()->pSQLResult);
    
    			char hwid[HWID_LENGTH];
    			strlcpy(hwid, row[0], sizeof(hwid));
    
    			if (strlen(hwid) == 0) {
    				sys_log(0, "HWID:: Player: %s have invalid hwid, check them manually.", targetname);
    				return;
    			}
    
    			if (IsBlocked(hwid)) {
    				sys_log(0, "HWID:: %s is already blocked.", hwid);
    				return;
    			}
    
    			m_blocked_hwid.push_back(hwid);
    
    			std::string ids;
    
    			std::unique_ptr<SQLMsg> getaccountsid(DBManager::instance().DirectQuery("SELECT id FROM player.player_index WHERE hwid='%s'", hwid));
    			if (getaccountsid->Get()->uiNumRows > 0) {
    				std::vector<int32_t> vec_ids;
    
    				MYSQL_ROW row2;
    				while ((row2 = mysql_fetch_row(getaccountsid->Get()->pSQLResult))) {
    					int32_t id = atoi(row2[0]);
    					if (std::find(vec_ids.begin(), vec_ids.end(), id) == vec_ids.end()) {
    						vec_ids.push_back(id);
    					}
    				}
    
    				for (auto id : vec_ids) {
    					ids += std::to_string(id);
    					ids += ",";
    				}
    
    				if (!ids.empty()) {
    					ids.erase(ids.end()- 1);
    					std::unique_ptr<SQLMsg> blockaccountsid(DBManager::instance().DirectQuery("UPDATE account.account SET status='BAN1' WHERE id IN (%s)", ids.c_str()));
    				}
    			}
    
    			std::unique_ptr<SQLMsg> blockhwid(DBManager::instance().DirectQuery("INSERT INTO account.blocked_hwids SET hwid='%s', who='%s', accounts='%s'", hwid, whoplayername, ids.c_str()));
    		}
    	}
    }
    
    void CHwidManager::SendUnblockHwid(const char * whoname, const char * targetname)
    {
    	THwidRequest pack;
    	strlcpy(pack.whoname, whoname, sizeof(pack.whoname));
    	strlcpy(pack.targetname, targetname, sizeof(pack.targetname));
    
    	db_clientdesc->DBPacket(HEADER_GD_UNBLOCKHWID, 0, &pack, sizeof(pack));
    }
    
    void CHwidManager::RecvUnblockHwid(const char * whoname, const char * targetname)
    {
    	if (!g_bAuthServer) {
    		return;
    	}
    
    	char whoplayername[CHARACTER_NAME_MAX_LEN * 2 + 1];
    	DBManager::instance().EscapeString(whoplayername, sizeof(whoplayername), whoname, strlen(whoname));
    
    	char playername[CHARACTER_NAME_MAX_LEN * 2 + 1];
    	DBManager::instance().EscapeString(playername, sizeof(playername), targetname, strlen(targetname));
    
    	std::unique_ptr<SQLMsg> msgid(DBManager::instance().DirectQuery("SELECT account_id FROM player.player WHERE name='%s' LIMIT 1", playername));
    	if (msgid->Get()->uiNumRows > 0) {
    		MYSQL_ROW rowid = mysql_fetch_row(msgid->Get()->pSQLResult);
    
    		std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery("SELECT hwid FROM player.player_index WHERE id=%d LIMIT 1", atoi(rowid[0])));
    		if (msg->Get()->uiNumRows > 0) {
    			MYSQL_ROW row = mysql_fetch_row(msg->Get()->pSQLResult);
    
    			char hwid[HWID_LENGTH];
    			strlcpy(hwid, row[0], sizeof(hwid));
    
    			if (strlen(hwid) == 0) {
    				sys_log(0, "HWID:: Player: %s have invalid hwid, check them manually.", targetname);
    				return;
    			}
    
    			if (!IsBlocked(hwid)) {
    				sys_log(0, "HWID:: %s is already unblocked.", hwid);
    				return;
    			}
    
    
    			auto v = std::find(m_blocked_hwid.begin(), m_blocked_hwid.end(), hwid);
    			if (v != m_blocked_hwid.end()) {
    				m_blocked_hwid.erase(v);
    			}
    
    			std::unique_ptr<SQLMsg> getaccountsid(DBManager::instance().DirectQuery("SELECT accounts FROM account.blocked_hwids WHERE hwid='%s'", hwid));
    			if (getaccountsid->Get()->uiNumRows > 0) {
    				MYSQL_ROW row2 = mysql_fetch_row(getaccountsid->Get()->pSQLResult);
    
    				char accountsid[255 + 1];
    				strlcpy(accountsid, row2[0], sizeof(accountsid));
    
    				std::unique_ptr<SQLMsg> unlockaccounts(DBManager::instance().DirectQuery("UPDATE account.account SET status='OK' WHERE id in (%s)", accountsid));
    				std::unique_ptr<SQLMsg>(DBManager::instance().DirectQuery("DELETE FROM account.blocked_hwids WHERE hwid='%s'", hwid));
    			}
    		}
    	}
    }
    

     

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