Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
C++ Read creature name from ID
Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: C++ Read creature name from ID

  1. #1

    C++ Read creature name from ID

    Hello i have small problem, because i don't know how to read any info about player from ID.
    i define creature id by:

    Code:
    #define CONTEXT_MENU_CREATUREID 	0x792E54;
    for example i have variable pid with creatureid:

    Code:
    DWORD* pid = (DWORD*)CONTEXT_MENU_CREATUREID;
    but how can i read creature name from this?


    // Tibia 8.54
    Thanks

  2. #2
    You need add offset for name
    probably
    Code:
    CONTEXT_MENU_CREATUREID + 0x4

  3. #3
    Don't work ;/

  4. #4
    Shouldn't 0x4 be 0x04 ? wouldn't it count it as 0x40 otherwise?

  5. #5
    Senior Member
    Join Date
    Jan 2008
    Location
    Cambridge, England
    Posts
    725
    Quote Originally Posted by Milice View Post
    Shouldn't 0x4 be 0x04 ? wouldn't it count it as 0x40 otherwise?
    Nope. 0x simply says that the following number is hexidecimal. The leading 0 is typically added for situations where you have addresses of varying lengths, to make code look pretty, e.g:

    Code:
    Address1 = 0x0005
    Address2 = 0x1234
    Looks nicer than

    Code:
    Address1 = 0x5
    Address2 = 0x1234
    Regarding reading creature name using CID, this is how it's done in the battle list, displayed in some sort of C# pseudocode mashup:

    Code:
    int playerCID = GetCID();
    int myCreatureIndex = 0;
    
    for (int i = 0; i < battleListMax; i++)
    {
        int currentCID = ReadInt(battleListStart + battleListStep * i);
        if (currentCID == playerCID)
        {
            myCreatureIndex = i;
            break;
        }
    }
    
    // Do whatever here, e.g:
    string playerName = ReadString(battleListStart + battleListStep * i + 0x4);
    It now strikes me that you're using an injected dll, so you'll need to replace all calls to ReadInt etc to casting.... That shit is too confusing for me at this time of night, but basically you just need to do what you have already, but casting to type of wchar_t * as opposed to DWORD *, or whatever char array you'll be using (I can't remember).
    Last edited by XtrmJash; 09-16-2014 at 07:32 AM.

  6. #6
    Quote Originally Posted by XtrmJash View Post

    Code:
    for (int i = 0; i++; i < battleListMax)
    This will cause infinite loop.

  7. #7
    Senior Member
    Join Date
    Jan 2008
    Location
    Cambridge, England
    Posts
    725
    Quote Originally Posted by szulak View Post
    This will cause infinite loop.
    Ooooooops.

  8. #8
    ok thanks, i will check in night and msg if it working

  9. #9
    Code:
    void gadaj()
    {
    /*
    This i have defined in external file
    #define SELF_EXPERIENCE 0x635F04
    #define SELFID (SELF_EXPERIENCE + 12)
    */
    
    int playerCID = SELFID;
    int myCreatureIndex = 0;
    for (int i = 0; i < MaxCreatures; i++)
    {
        int currentCID = ReadMemoryInt(FindWindow("ARKAMECZEK ", NULL),(BattlelistBegin + BattlelistStep * i),sizeof(int32_t));
        if (currentCID == playerCID)
        {
            myCreatureIndex = i;
    
            break;
        }
    }
    char value[32];
     ReadMemoryChars(FindWindow("ARKAMECZEK ", NULL),(BattlelistBegin + BattlelistStep * myCreatureIndex + 0x4),value,32);
    string str = string(value);
        	Say(0x01, const_cast<char*>(str.c_str()));
    }
    + reading functions:

    Code:
    inline int ReadMemoryInt(HWND h, int address, int size)
    {
    	int ret = 0;
    	ReadProcessMemory(h, (LPVOID)address, &ret, size, 0);
    	return ret;
    }
    
    inline void ReadMemoryChars(HWND h, int address, char* ret, int size)
    {
        ReadProcessMemory(h, (LPVOID)address, &ret, size, 0);
    }
    resolut of this code is randomly:

    Code:
    21:45 Arkam: í
     21:47 Arkam: 
     21:47 Arkam:
    /\ Arkam is name ingame, i testing it on ContextMenu then resolut is empty []

  10. #10
    Senior Member
    Join Date
    Jan 2008
    Location
    Cambridge, England
    Posts
    725
    Code:
    FindWindow("ARKAMECZEK ", NULL)
    Is the clients class name ARKAMECZEK?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •