Results 1 to 9 of 9
  1. #1
    Sneak84's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    88
    Reputation
    10
    Thanks
    18

    About hotkeys again [changing weapon text]

    I want to change/restore weapon text in the lower right corner.
    I think i need to backup old text for weapons to make it work, so i'm define 3 functions: first function change the text for all weapons, second save the original text, third restore it.

    Code:
    typedef struct {
         char* name;
    } old_name;
    
    old_name old[700];
    
    // change text for all weapons
    void ChangeWT(DWORD CShell, char * String) 
    {
        DWORD pWeaponMgr = *(DWORD*) ( CShell + WeaponMgr );
        int  sizeString  = strlen(String);
    
        if ( pWeaponMgr )
        {
            for ( int i = 0; i < 700; i++ )
            {
                DWORD pWeapon = *(unsigned long*) ( pWeaponMgr + (i*4) );
    
                if ( pWeapon )
                {
                   char * weaponName = (char*) ( pWeapon + 0x000008 );
                   memcpy(weaponName, String, sizeString);
                }
          }
       }
    }
    
    // backup text for all weapons
    void SaveWT(DWORD CShell) 
    {
        DWORD pWeaponMgr = *(DWORD*) ( CShell + WeaponMgr );
    
        if ( pWeaponMgr )
        {
            for ( int i = 0; i < 700; i++ )
            {
                DWORD pWeapon = *(unsigned long*) ( pWeaponMgr + (i*4) );
    
                if ( pWeapon )
                {
                   char * weaponName = (char*) ( pWeapon + 0x000008 );
                   memcpy(old[i].name, weaponName, lstrlen(weaponName));
                }
          }
       }
    }
    
    // restore saved text
    void RestoreWT(DWORD CShell) 
    {
        DWORD pWeaponMgr = *(DWORD*) ( CShell + WeaponMgr );
    
        if ( pWeaponMgr )
        {
            for ( int i = 0; i < 700; i++ )
            {
                DWORD pWeapon = *(unsigned long*) ( pWeaponMgr + (i*4) );
    
                if ( pWeapon )
                {
                   char * weaponName = (char*) ( pWeapon + 0x000008 );
                   memcpy(weaponName, old[i].name, lstrlen(old[i].name));
                }
          }
       }
    }
    
    if ( !bInitHacks )
    {
       SaveWT(CShell);
       bInitHacks = true;  
    }
    
    // in another thread
    if ( GetAsyncKeyState(VK_F9) )
    {
       bNoReload =! bNoReload;
    
       if ( bNoReload )
       // if user press f9 then we enable hack and change a weapon text for 3 seconds
       ChangeWT(CShell, "No reload:     ON");
    else
       ChangeWT(CShell, "No reload:     OFF");
    
       Sleep(3000);
      
       // then we just restore the original text
       RestoreWT(CShell);
    }
    Is not that cool? But help me with restoring text. When i use this way, game crashes when i join in room.

    Oh forget, original idea for changing weapon text: dakr54. Here:
    https://www.mpgh.net/forum/242-crossf...apon-text.html

  2. #2
    [mi5's Avatar
    Join Date
    Mar 2012
    Gender
    male
    Posts
    301
    Reputation
    10
    Thanks
    618
    xD


  3. #3
    TrollerCoaster's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    I am a fish
    Posts
    633
    Reputation
    61
    Thanks
    800
    The game doesn't store the length of the string nor will C try to recognize zero-terminated strings from memory. Specify the size yourself.

  4. The Following User Says Thank You to TrollerCoaster For This Useful Post:

    Sneak84 (07-12-2012)

  5. #4
    Sneak84's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    88
    Reputation
    10
    Thanks
    18
    Quote Originally Posted by TrollerCoaster View Post
    The game doesn't store the length of the string nor will C try to recognize zero-terminated strings from memory. Specify the size yourself.
    Code:
    typedef struct {
         char* name;
    } old_name;
    
    old_name old[700];
    
    // backup text for all weapons
    void SaveWT(DWORD CShell) 
    {
        DWORD pWeaponMgr = *(DWORD*) ( CShell + WeaponMgr );
    
        if ( pWeaponMgr )
        {
            for ( int i = 0; i < 700; i++ )
            {
                DWORD pWeapon = *(unsigned long*) ( pWeaponMgr + (i*4) );
    
                if ( pWeapon )
                {
                   char * weaponName = (char*) ( pWeapon + 0x000008 );
                   memcpy(old[i].name, weaponName, 15);
                }
          }
       }
    }
    
    //
    if ( GetAsyncKeyState(VK_F2) )
    {
       SaveWT(CShell);
    }
    The game crashes when i try to backup the text (pressing F2). Maybe there is another way to backup/restore (withot structure and memcpy)?
    Last edited by Sneak84; 07-12-2012 at 07:53 AM.

  6. #5
    desertflame's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Posts: 23847611237
    Posts
    380
    Reputation
    48
    Thanks
    850
    My Mood
    Amused
    Quote Originally Posted by [mi5 View Post
    xD

    What kind of fucking post is this? :/
    Anyway good luck @Sneak84. Sorry I can't help here . (lacking sufficient knowledge)

  7. #6
    Sneak84's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    88
    Reputation
    10
    Thanks
    18
    Thx, desertflame.

    Guys, what the fuck with you? Include your brains and think a little bit. Enought to do an auto on hacks.

  8. #7
    Fly3r's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    Not telling.
    Posts
    720
    Reputation
    18
    Thanks
    265
    My Mood
    Paranoid
    @Sneak84 found something that may help you.
    Here it is

    ~Credits : Dakr54
    Joined MPGH: 07/08/09


    i used to tell arrow to the knee jokes then i died due to blood loss from takeing tomany arrows to the knee at once
    A network problem caused by you? What did you do? Trip over the cable?




  9. #8
    Code[VB]'s Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    CODER
    Posts
    608
    Reputation
    11
    Thanks
    702
    My Mood
    Bitchy
    1. Wtf are you doing???
    2. It seems that you do not know how to code just simple basic & arrys
    3. please learn first, then come here and ask..

    If i'm false, here is the Solution:
    - go ingame, scan the weapon char with CE
    - find pointer
    - use an Backup Array call it before you edit it..
    - check it with bool
    - if checked > u can edit & reset

  10. The Following 4 Users Say Thank You to Code[VB] For This Useful Post:

    Fly3r (07-13-2012),Sneak84 (07-13-2012),[mi5 (07-13-2012),|Skrillex| (07-13-2012)

  11. #9
    Sneak84's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    88
    Reputation
    10
    Thanks
    18
    Quote Originally Posted by Code[VB] View Post
    1. Wtf are you doing???
    2. It seems that you do not know how to code just simple basic & arrys
    3. please learn first, then come here and ask..

    If i'm false, here is the Solution:
    - go ingame, scan the weapon char with CE
    - find pointer
    - use an Backup Array call it before you edit it..
    - check it with bool
    - if checked > u can edit & reset
    looks not so easy, but thanks for the solution. never said that i'm good at c++, still learning.

Similar Threads

  1. [Source Code] Change weapon text
    By dakr54 in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 5
    Last Post: 05-08-2012, 02:21 PM
  2. [Discussion] can u change weapon damages?
    By n1k0la1 in forum Blackshot Hacks & Cheats
    Replies: 4
    Last Post: 12-10-2009, 08:49 AM
  3. [nub, possibly] idea about character color change
    By lowerboy90 in forum Combat Arms Hacks & Cheats
    Replies: 12
    Last Post: 03-12-2009, 02:33 PM
  4. question about Hotkeys
    By bohnenbong in forum Visual Basic Programming
    Replies: 5
    Last Post: 01-04-2008, 09:31 AM
  5. Change weapon texture
    By carpanthers1 in forum WarRock - International Hacks
    Replies: 6
    Last Post: 11-10-2007, 09:20 AM