Jump to content
Maintenance ×
×
×
  • Create New...
  • 0

Function update last login real time


Karbust

Question

  • Web Developer

Hello,

I'm using a function released by Optimus (created by VegaS) for the Market Metin2CMS, but when I start the game and enter in the map, I get disconnected and that core crashes...

gdb:

Spoiler
[email protected]:~ # gdb /usr/home/game/share/bin/game /usr/home/game/cores/channel1/game1/game.core
GNU gdb (GDB) 7.12 [GDB v7.12 for FreeBSD]
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-portbld-freebsd9.3".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/home/game/share/bin/game...done.
[New LWP 100091]
[New LWP 100145]
[New LWP 100141]
[New LWP 100140]
Core was generated by `game'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  CInputLogin::Entergame ([email protected]=0x485ac46c, [email protected]=0x485ac400, [email protected]=0x4877f000 "\n\317etin2Release.exe") at input_login.cpp:596
596             if (ch->GetLevel() > pLevel)
[Current thread is 1 (LWP 100091)]
(gdb) bt
#0  CInputLogin::Entergame ([email protected]=0x485ac46c, [email protected]=0x485ac400, [email protected]=0x4877f000 "\n\317etin2Release.exe") at input_login.cpp:596
#1  0x0815c88a in CInputLogin::Analyze (this=0x485ac46c, d=0x485ac400, bHeader=10 '\n', c_pData=0x4877f000 "\n\317etin2Release.exe") at input_login.cpp:1234
#2  0x0814cc3a in CInputProcessor::Process (this=0x485ac46c, lpDesc=0x485ac400, c_pvOrig=<optimized out>, [email protected]: 0, iBytes=<optimized out>) at input.cpp:104
#3  0x081121d9 in DESC::ProcessInput ([email protected]=0x485ac400) at desc.cpp:313
#4  0x0828d1e4 in io_loop (fdw=0x293c6580) at main.cpp:1157
#5  0x0828d467 in idle () at main.cpp:1034
#6  0x080564e5 in main (argc=1, argv=0xbfbfec88) at main.cpp:680
(gdb) bt full
#0  CInputLogin::Entergame ([email protected]=0x485ac46c, [email protected]=0x485ac400, [email protected]=0x4877f000 "\n\317etin2Release.exe") at input_login.cpp:596
        __FUNCTION__ = "Entergame"
        p2 = {header = 0 '\000', channel = 0 '\000'}
        pos = {x = -1, y = 680360896, z = 12561408}
        p = {bHeader = 0 '\000', time = 0}
#1  0x0815c88a in CInputLogin::Analyze (this=0x485ac46c, d=0x485ac400, bHeader=10 '\n', c_pData=0x4877f000 "\n\317etin2Release.exe") at input_login.cpp:1234
        iExtraLen = 0
        __FUNCTION__ = "Analyze"
#2  0x0814cc3a in CInputProcessor::Process (this=0x485ac46c, lpDesc=0x485ac400, c_pvOrig=<optimized out>, [email protected]: 0, iBytes=<optimized out>) at input.cpp:104
        iExtraPacketSize = <optimized out>
        bHeader = 10 '\n'
        c_pszName = 0x48757bcc "EnterGame"
        bLastHeader = <optimized out>
        iLastPacketLen = <optimized out>
        iPacketLen = 2
        c_pData = 0x4877f000 "\n\317etin2Release.exe"
#3  0x081121d9 in DESC::ProcessInput ([email protected]=0x485ac400) at desc.cpp:313
        iBytesProceed = 0
        bytes_read = 2
        __FUNCTION__ = "ProcessInput"
#4  0x0828d1e4 in io_loop (fdw=0x293c6580) at main.cpp:1157
        iRet = <optimized out>
        d = 0x485ac400
        num_events = 3
        event_idx = 2
        __FUNCTION__ = "io_loop"
#5  0x0828d467 in idle () at main.cpp:1034
        pta = {tv_sec = 1497556321, tv_usec = 17656}
        now = {tv_sec = 1497556321, tv_usec = 447657}
        t = 42487
        process_time_count = 10
#6  0x080564e5 in main (argc=1, argv=0xbfbfec88) at main.cpp:680
        db_manager = {<singleton<DBManager>> = {_vptr.singleton = 0x843ed00 <vtable for DBManager+8>, static ms_singleton = 0xbfbfe2b4}, m_sql = <incomplete type>, m_sql_direct = <incomplete type>, m_bIsConnect = true,
          m_map_dbstring = std::map with 0 elements, m_vec_GreetMessage = std::vector of length 0, capacity 0, m_map_pkLoginData = std::map with 0 elements, mapLDBilling = std::map with 0 elements,
          m_vec_kUseTime = std::vector of length 0, capacity 0}
        XTManager = {<singleton<CXTrapManager>> = {_vptr.singleton = 0x8462350 <vtable for CXTrapManager+8>, static ms_singleton = 0xbfbfbbd8}, m_pImpl = 0x28c12400, m_mapClientSessions = {
            table_ = {<boost::unordered_detail::hash_table<boost::unordered_detail::map<unsigned int, boost::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, CXTrapManager::sSessionInfo> > > >> = {<boost::unordered_detail::hash_buckets<std::allocator<std::pair<unsigned int const, CXTrapManager::sSessionInfo> >, boost::unordered_detail::ungrouped>> = {buckets_ = 0x0, bucket_count_ = 11,
                  allocators_ = {<boost::details::compressed_pair_imp<std::allocator<boost::unordered_detail::hash_bucket<std::allocator<std::pair<unsigned int const, CXTrapManager::sSessionInfo> > > >, std::allocator<boost::unordered_detail::hash_node<std::allocator<std::pair<unsigned int const, CXTrapManager::sSessionInfo> >, boost::unordered_detail::ungrouped> >, 3>> = {<std::allocator<boost::unordered_detail::hash_bucket<std::allocator<std::pair<unsigned int const, CXTrapManager::sSessionInfo> > > >> = {<__gnu_cxx::new_allocator<boost::unordered_detail::hash_bucket<std::allocator<std::pair<unsigned int const, CXTrapManager::sSessionInfo> > > >> = {<No data fields>}, <No data fields>}, <std::allocator<boost::unordered_detail::hash_node<std::allocator<std::pair<unsigned int const, CXTrapManager::sSessionInfo> >, boost::unordered_detail::ungrouped> >> = {<__gnu_cxx::new_allocator<boost::unordered_detail::hash_node<std::allocator<std::pair<unsigned int const, CXTrapManager::sSessionInfo> >, boost::unordered_detail::ungrouped> >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}}, <boost::unordered_detail::hash_buffered_functions<boost::hash<unsigned int>, std::equal_to<unsigned int> >> = {current_ = false, funcs_ = {{data_ = {buf = "", align_ = 0 '\000'}}, {data_ = {buf = "", align_ = 0 '\000'}}}}, size_ = 0, mlf_ = 1, cached_begin_bucket_ = 0x0,
                max_load_ = 0}, <No data fields>}}}
        temp_exp_line = "2147483646"
        item_manager = {<singleton<ITEM_MANAGER>> = {_vptr.singleton = 0x84497f8 <vtable for ITEM_MANAGER+8>, static ms_singleton = 0xbfbfb9c8}, m_vec_prototype = std::vector of length 7015, capacity 7015 = {{<SEntityTable> = {
                dwVnum = 1}, dwVnumRange = 0, szName = "\265\267\262\331\267\257\271\314", '\000' <repeats 42 times>, szLocaleName = "Yang", '\000' <repeats 46 times>, bType = 9 '\t', bSubType = 0 '\000', bWeight = 0 '\000',
              bSize = 1 '\001', dwAntiFlags = 0, dwFlags = 0, dwWearFlags = 0, dwImmuneFlag = 0, dwGold = 0, dwShopBuyPrice = 0, aLimits = {{bType = 0 '\000', lValue = 0}, {bType = 0 '\000', lValue = 0}}, aApplies = {{bType = 0 '\000',
                  lValue = 0}, {bType = 0 '\000', lValue = 0}, {bType = 0 '\000', lValue = 0}}, alValues = {0, 0, 0, 0, 0, 0}, alSockets = {0, 0, 0, 0, 0, 0}, dwRefinedVnum = 0, wRefineSet = 0, bAlterToMagicItemPct = 0 '\000',
              bSpecular = 0 '\000', bGainSocketPct = 0 '\000', sAddonType = 0, cLimitRealTimeFirstUseIndex = -1 '\377', cLimitTimerBasedOnWearIndex = -1 '\377'}, {<SEntityTable> = {dwVnum = 2}, dwVnumRange = 0,
              szName = "\307\321\261\271\271\253\275\326\271\366\301\257", '\000' <repeats 38 times>, szLocaleName = "Vers\343o Portuguesa", '\000' <repeats 33 times>, bType = 0 '\000', bSubType = 0 '\000', bWeight = 0 '\000',
              bSize = 1 '\001', dwAntiFlags = 0, dwFlags = 0, dwWearFlags = 0, dwImmuneFlag = 0, dwGold = 0, dwShopBuyPrice = 0, aLimits = {{bType = 0 '\000', lValue = 0}, {bType = 0 '\000', lValue = 0}}, aApplies = {{bType = 0 '\000',
                  lValue = 0}, {bType = 0 '\000', lValue = 0}, {bType = 0 '\000', lValue = 0}}, alValues = {0, 0, 0, 0, 0, 0}, alSockets = {0, 0, 0, 0, 0, 0}, dwRefinedVnum = 0, wRefineSet = 0, bAlterToMagicItemPct = 0 '\000',
              bSpecular = 0 '\000', bGainSocketPct = 0 '\000', sAddonType = 0, cLimitRealTimeFirstUseIndex = -1 '\377', cLimitTimerBasedOnWearIndex = -1 '\377'}, {<SEntityTable> = {dwVnum = 10}, dwVnumRange = 0,
              szName = "\265\265+0", '\000' <repeats 46 times>, szLocaleName = "Espada+0", '\000' <repeats 42 times>, bType = 1 '\001', bSubType = 0 '\000', bWeight = 0 '\000', bSize = 2 '\002', dwAntiFlags = 32, dwFlags = 1,
              dwWearFlags = 16, dwImmuneFlag = 0, dwGold = 0, dwShopBuyPrice = 0, aLimits = {{bType = 1 '\001', lValue = 0}, {bType = 0 '\000', lValue = 0}}, aApplies = {{bType = 7 '\a', lValue = 22}, {bType = 0 '\000', lValue = 0}, {
                  bType = 0 '\000', lValue = 0}}, alValues = {0, 15, 19, 13, 15, 0}, alSockets = {0, 0, 0, 0, 0, 0}, dwRefinedVnum = 11, wRefineSet = 1, bAlterToMagicItemPct = 0 '\000', bSpecular = 0 '\000', bGainSocketPct = 1 '\001',
              sAddonType = 0, cLimitRealTimeFirstUseIndex = -1 '\377', cLimitTimerBasedOnWearIndex = -1 '\377'}, {<SEntityTable> = {dwVnum = 11}, dwVnumRange = 0, szName = "\265\265+1", '\000' <repeats 46 times>,
              szLocaleName = "Espada+1", '\000' <repeats 42 times>, bType = 1 '\001', bSubType = 0 '\000', bWeight = 0 '\000', bSize = 2 '\002', dwAntiFlags = 32, dwFlags = 1, dwWearFlags = 16, dwImmuneFlag = 0, dwGold = 100,
              dwShopBuyPrice = 100, aLimits = {{bType = 1 '\001', lValue = 0}, {bType = 0 '\000', lValue = 0}}, aApplies = {{bType = 7 '\a', lValue = 22}, {bType = 0 '\000', lValue = 0}, {bType = 0 '\000', lValue = 0}}, alValues = {0,
                15, 19, 13, 15, 7}, alSockets = {0, 0, 0, 0, 0, 0}, dwRefinedVnum = 12, wRefineSet = 2, bAlterToMagicItemPct = 0 '\000', bSpecular = 0 '\000', bGainSocketPct = 1 '\001', sAddonType = 0,
---Type <return> to continue, or q <return> to quit---quit
cLimitRealTimeFirstUseIndex = -1 '\Quit
(gdb)

 

This is the code:

/*********
* file:			input_login.cpp
* description: 		Time update in real-time table last_play
* date: 		Tuesday, Aug 01 st 2016, 02:44am
* author: VegaS 
*/

//1.) Search:
void CInputLogin::Entergame(LPDESC d, const char * data)
{
	LPCHARACTER ch;
	[........................................]
} 

//2.) Add bellow:
#ifdef ENABLE_UPDATE_LASTPLAY_REAL_TIME
/*********
* I put this verification level as not to over apply database updates elsewhere for characters that start at
* first on the game that is at level 1, I believe that it is not necessary for a player of that level to have time adapted real-time.
*/
	int pLevel = 0; // To begin initialize of level 5 ++

	if (ch->GetLevel() > pLevel) 
	{	
		char pUpdateTime[1024];
		snprintf(pUpdateTime, sizeof(pUpdateTime), "UPDATE player.player SET last_play = NOW() WHERE id = %u", ch->GetPlayerID());
		std::auto_ptr<SQLMsg> sUpdate(DBManager::instance().DirectQuery(pUpdateTime));
	}
#endif

I already tried to remove the if condition, but then I get the error on snprintf, also tried to remove it and set the query directly on the DirectQuery function, but then I get the error here...

Someone can help me? What is wrong with that function?

Thanks

EDIT:

Solved!

I put the function after ch->SendGreetMessage();

Edited by charparodar
solved
  • Love 1

QJ0orbR.png

Metin2 Icon Database

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.


  • Activity

    1. 3

      Back to the Dungeon System 7, 8, 9th Floor Problem

    2. 3

      Back to the Dungeon System 7, 8, 9th Floor Problem

    3. 3

      Back to the Dungeon System 7, 8, 9th Floor Problem

    4. 0

      Some mobs dont drop items

    5. 3

      Back to the Dungeon System 7, 8, 9th Floor Problem

    6. 691

      [Group] Daily Music - Share your favorite!

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.