Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Apoc91's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    59
    Reputation
    10
    Thanks
    35
    My Mood
    Twisted
    Quote Originally Posted by Nubzgetkillz View Post
    I get what you guys are saying, and I want to learn new stuff once you do learn new stuff you feel good.
    So that is why I try to be less of a leecher, and try to learn more about C++ language.

    Your past hack releases are great and have the look of a good coder. Even though I have only seen screenshots

    so people could be doing:
    Code:
    int hacks [] = {f1, f2, f3, f4, f5};
    sorry if i am typing random shit.
    If you're using C++ you can just use the 'bool' type:

    Code:
    #include "CAHacks.h"
    
    .... // More code in your program
    
    HRESULT WINAPI EndScene(LPDIRECT3DDEVICE9 pDevice)
    {
        static bool bMenu = false; // a static variable holds it's state throughout
                                            // each invocation of the method.
    
        static int menu_length = sizeof(menus) / sizeof(menus[0]); // Calculate the number of menus in the menu array.
    
        if(GetAsyncKeyState(VK_INSERT) & 1)
            bMenu = !bMenu; // This will toggle bMenu, if it was true, now it's false
                                    // and vice-versa.
    
        if(bMenu) // Is the menu open?
        {
            static int menu_selection = 0; // start at menu index 0
            // Yep...
            
            if(GetAsyncKeyState(VK_UP) & 1) // If the up-key is down then we're 
                                                          // decrementing the menu index.
                if(menu_selection > 0)
                    menu_selection--;
            else if(GetAsyncKeyState(VK_DOWN) & 1) // If the up key isn't down, 
                                                                     // but the down key is, we're
                                                                     // incrementing the menu index
                if(menu_select < (menu_length - 1))
                    menu_selection++;
            else if((GetAsyncKeyState(VK_LEFT) & 1) || (GetAsyncKeyState(VK_RIGHT) & 1))
                    menus[menu_selection].bActivated = !menus[menu_selection].bActivated; // Toggle whether that hack is activated.
        }
    
        // Now just iterate through the menus turning off/on whatever is off/on
        char buf[1024]; // Use this buffer to send commands.
        for(int x = 0; x < menu_length; x++) 
        {
            CAHack cur = menus[x];
    
            if(cur.szConsoleCommand) == NULL) // If the command is null, just call the helper function and continue.
            {
                cur.lpfnHack(pDevice, cur.bActivated);
                continue; // Go on to the next element in our array.
            }
    
            sprintf_s(buf, 1024, "%s %s", cur.szConsoleCommand, cur.bActivated ?cur.szActivatedValue : cur.szDefaultValue);
            RunConsoleCommand(buf);
        }
    }
    The CAHack struct is defined as so:

    Code:
    typedef void (* Hack_T)(LPDIRECT3DDEVICE9 pDevice, bool activated);
    
    // Prototypes:
    void SuperBullets(LPDIRECT3DDEVICE9, bool);
    
    struct CAHack
    {
        const char* szDisplayName; // The name showed on the menu.
        const char* szConsoleCommand; // The console command, or NULL
        const char* szDefaultValue; // The value when the command is off.
        const char* szActivatedValue; // The value when the command is on.
        bool bActivated; // Is the hack activated?
        Hack_T lpfnHack; // If the szConsoleCommand is NULL, we call this function.
    }
    
    CAHack menus[] =
    {
        { "Show FPS", "ShowFps", "0", "1", false, NULL }
        { "Super Bullets", NULL, NULL, NULL, false, &SuperBullets }
    }
    
    void SuperBullets(LPDIRECT3DDEVICE9 pDevice, bool activated)
    {
        if(activated)
            Nop(SUPER_BULLETS_ADDR, "\x90\x90\x90", 3);
        else
            Nop(SUPER_BULLETS_ADDR, "\x0F\x94\xC0", 3);
    }
    Forgive me if some of that has errors, I typed it up in the quick reply haha, but you should get a general idea of a better way to do it.

    NOTE: In no way am I saying this is the best way, nor am I saying I'm a great programmer. I'm just trying to shed some light to the part of the community that is left in the dark.
    Last edited by Apoc91; 12-01-2010 at 01:33 PM.

  2. #17
    DoubleDutch's Avatar
    Join Date
    Sep 2007
    Gender
    male
    Location
    Koning
    Posts
    11,346
    Reputation
    1179
    Thanks
    1,199
    My Mood
    Bored
    Because the values get detected easily.

  3. #18
    Apoc91's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    59
    Reputation
    10
    Thanks
    35
    My Mood
    Twisted
    Quote Originally Posted by DoubleDutch View Post
    Because the values get detected easily.
    I'm a bit confused now, what does that have to do with bad programming?

  4. #19
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    Quote Originally Posted by Nubzgetkillz View Post
    I get what you guys are saying, and I want to learn new stuff once you do learn new stuff you feel good.
    So that is why I try to be less of a leecher, and try to learn more about C++ language.

    Your past hack releases are great and have the look of a good coder. Even though I have only seen screenshots

    so people could be doing:
    Code:
    int hacks [] = {f1, f2, f3, f4, f5};
    sorry if i am typing random shit.
    "f1" is not an int. It would be more like

    int hacks[10];
    for (int i = 0; i < sizeof(hacks); i++)
    hacks[i] = false;

    Quote Originally Posted by DoubleDutch View Post
    Because the values get detected easily.
    Nope, unfortunately you're wrong there. Boolean vales are in no may easier to detect than integer values, both alone or in arrays. <.<

    (typed on mobile)

  5. #20
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    Quote Originally Posted by freedompeace View Post
    Yeahs. There's a reason why my releases' source code is only available to people who meet my criteria x]

    There's so much you can learn, don't you feel good when you gain a bit more knowledge?

    People are missing out. Missing out badly.
    And what is this criteria x you speak of ..?

Page 2 of 2 FirstFirst 12