Results 1 to 10 of 10
  1. #1
    OVOMobZai's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Location
    hell
    Posts
    209
    Reputation
    83
    Thanks
    163
    My Mood
    Devilish

    Question What's Wrong with This Code?

    Code:
    using System;using System.Diagnostics;
    using System.Runtime.InteropServices;
    using System.Threading;
    
    
    namespace VAM_Bhop_Tut
    {
        class Program
        {
    
    
            public static int aLocalPlayer = 0x00A8D53C;
            public static int oFlags = 0x100;
            public static int aJump = 0x04F457EC;
    
    
            public static string process = "csgo";
            public static int bClient;
    
    
            [DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true)]
            public static extern int GetAsyncKeyState(int vKey);
    
    
            static void Main(string[] args)
            {
    
    
                VAMemory vam = new VAMemory(process);
    
    
                if (GetModuleAddy())
                {
                    int fJump = bClient + aJump;
                    aLocalPlayer = bClient + aLocalPlayer;
                    int LocalPlayer = vam.ReadInt32((IntPtr)aLocalPlayer);
    
    
                    int aFlags = LocalPlayer + oFlags;
    
    
                    while (true)
                    {
                        if (GetAsyncKeyState(32) > 0)
                        {
    
    
                            Console.WriteLine("Pressing Space");
                        }
                        while (GetAsyncKeyState(32) > 0)
                        {
    
    
                            int Flags = vam.ReadInt32((IntPtr)aFlags);
    
    
                            if (Flags == 257)
                            {
    
    
                                vam.WriteInt32((IntPtr)fJump, 5);
                                Thread.Sleep(10);
                                vam.WriteInt32((IntPtr)fJump, 4);
    
    
                                Console.Clear();
                                Console.WriteLine("Jumping", Console.ForegroundColor = ConsoleColor.Green);
    
    
                            }
                        }
                        Console.Clear();
                        Console.WriteLine("Standing", Console.ForegroundColor = ConsoleColor.Yellow);
                        Thread.Sleep(10);
    
    
                    }
    
    
                }
    
    
            }
    
    
            static bool GetModuleAddy()
            {
                try
                {
                    Process[] p = Process.GetProcessesByName(process);
    
    
                    if (p.Length > 0)
                    {
    
    
                        foreach (ProcessModule m in p[0].Modules)
                        {
    
    
                            if (m.ModuleName == "client.dll")
                            {
                                bClient = (int)m.BaseAddress;
                                return true;
                            }
                            
                        }
                        return true;
                    }
    
    
                    else
                    {
                        return false;
                    }
                }
    
    
    
    
    
    
                catch (Exception ex)
                {
                    return false;
                }
            }
                
            }
    
    
    
    
    
    
    
    
    }


    - - - Updated - - -

    After some research... I think I've found the cause. It's the GetASyncKeyState, it's not working, it's not detecting when I press Space :/

    How do you create a properly working one in C#?
    Connect with me an shit:

    IG
    Twitter
    MySpace (jk)
    Snapchat: fadiastifan

  2. #2
    Koolsami7's Avatar
    Join Date
    May 2012
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0
    Code:
    [DllImport("user32.dll")]
    public static extern short GetAsyncKeyState(int vKey);

  3. #3
    OVOMobZai's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Location
    hell
    Posts
    209
    Reputation
    83
    Thanks
    163
    My Mood
    Devilish
    Quote Originally Posted by Koolsami7 View Post
    Code:
    [DllImport("user32.dll")]
    public static extern short GetAsyncKeyState(int vKey);
    Nope, not working
    Connect with me an shit:

    IG
    Twitter
    MySpace (jk)
    Snapchat: fadiastifan

  4. #4
    Lols12342's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Posts
    188
    Reputation
    19
    Thanks
    701
    My Mood
    Amazed
    Quote Originally Posted by OVOMobZai View Post
    Code:
    using System;using System.Diagnostics;
    using System.Runtime.InteropServices;
    using System.Threading;
    
    
    namespace VAM_Bhop_Tut
    {
        class Program
        {
    
    
            public static int aLocalPlayer = 0x00A8D53C;
            public static int oFlags = 0x100;
            public static int aJump = 0x04F457EC;
    
    
            public static string process = "csgo";
            public static int bClient;
    
    
            [DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true)]
            public static extern int GetAsyncKeyState(int vKey);
    
    
            static void Main(string[] args)
            {
    
    
                VAMemory vam = new VAMemory(process);
    
    
                if (GetModuleAddy())
                {
                    int fJump = bClient + aJump;
                    aLocalPlayer = bClient + aLocalPlayer;
                    int LocalPlayer = vam.ReadInt32((IntPtr)aLocalPlayer);
    
    
                    int aFlags = LocalPlayer + oFlags;
    
    
                    while (true)
                    {
                        if (GetAsyncKeyState(32) > 0)
                        {
    
    
                            Console.WriteLine("Pressing Space");
                        }
                        while (GetAsyncKeyState(32) > 0)
                        {
    
    
                            int Flags = vam.ReadInt32((IntPtr)aFlags);
    
    
                            if (Flags == 257)
                            {
    
    
                                vam.WriteInt32((IntPtr)fJump, 5);
                                Thread.Sleep(10);
                                vam.WriteInt32((IntPtr)fJump, 4);
    
    
                                Console.Clear();
                                Console.WriteLine("Jumping", Console.ForegroundColor = ConsoleColor.Green);
    
    
                            }
                        }
                        Console.Clear();
                        Console.WriteLine("Standing", Console.ForegroundColor = ConsoleColor.Yellow);
                        Thread.Sleep(10);
    
    
                    }
    
    
                }
    
    
            }
    
    
            static bool GetModuleAddy()
            {
                try
                {
                    Process[] p = Process.GetProcessesByName(process);
    
    
                    if (p.Length > 0)
                    {
    
    
                        foreach (ProcessModule m in p[0].Modules)
                        {
    
    
                            if (m.ModuleName == "client.dll")
                            {
                                bClient = (int)m.BaseAddress;
                                return true;
                            }
                            
                        }
                        return true;
                    }
    
    
                    else
                    {
                        return false;
                    }
                }
    
    
    
    
    
    
                catch (Exception ex)
                {
                    return false;
                }
            }
                
            }
    
    
    
    
    
    
    
    
    }


    - - - Updated - - -

    After some research... I think I've found the cause. It's the GetASyncKeyState, it's not working, it's not detecting when I press Space :/

    How do you create a properly working one in C#?
    This might be useful

    https://www.mpgh.net/forum/showthread.php?t=120656
    [IMG]https://cloud-3.steamuserconten*****m/ugc/28484756670281268/F8BB74EE89D3C55FD4286CBAA083D7976AFAB5AA/[/IMG]

    Hacking valve secure servers with a r00ted vpn irak.

  5. #5
    OVOMobZai's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Location
    hell
    Posts
    209
    Reputation
    83
    Thanks
    163
    My Mood
    Devilish
    Quote Originally Posted by Lols12342 View Post
    I tried reading it but I still don't understand. When I write VK_KEY it says it's invalid, what should I define the public static extern... etc as? Right now it's : public static extern short GetAsyncKeyState(int vKey);
    Connect with me an shit:

    IG
    Twitter
    MySpace (jk)
    Snapchat: fadiastifan

  6. #6
    Block4o's Avatar
    Join Date
    Jul 2013
    Gender
    male
    Location
    /r/capitalism
    Posts
    197
    Reputation
    55
    Thanks
    8,563
    My Mood
    Asleep
    Code:
    [DllImport("user32.dll")]
            static extern ushort GetAsyncKeyState(int vKey);
    
            public static bool IsKeyPushedDown(System.Windows.Forms.Keys vKey)
            {
                return 0 != (GetAsyncKeyState((int)vKey) & 0x8000);
            }
    There you go.
    Please drop that yellow font of yours, can't read it
    Faith-based morality isn't morality at all; it's obedience.

  7. The Following User Says Thank You to Block4o For This Useful Post:

    OVOMobZai (10-29-2016)

  8. #7
    OVOMobZai's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Location
    hell
    Posts
    209
    Reputation
    83
    Thanks
    163
    My Mood
    Devilish
    Quote Originally Posted by Block4o View Post
    Code:
    [DllImport("user32.dll")]
            static extern ushort GetAsyncKeyState(int vKey);
    
            public static bool IsKeyPushedDown(System.Windows.Forms.Keys vKey)
            {
                return 0 != (GetAsyncKeyState((int)vKey) & 0x8000);
            }
    There you go.
    Please drop that yellow font of yours, can't read it
    Thank you man! This worked. Can you explain to me what this snippet of code is doing?
    Connect with me an shit:

    IG
    Twitter
    MySpace (jk)
    Snapchat: fadiastifan

  9. #8
    goochguy's Avatar
    Join Date
    Feb 2014
    Gender
    male
    Posts
    22
    Reputation
    10
    Thanks
    5
    The problem with the code is that you pasted it without a single clue of what you are doing. Learn a coding language before you try to use it.

  10. #9
    OVOMobZai's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Location
    hell
    Posts
    209
    Reputation
    83
    Thanks
    163
    My Mood
    Devilish
    Quote Originally Posted by goochguy View Post
    The problem with the code is that you pasted it without a single clue of what you are doing. Learn a coding language before you try to use it.
    I did not "paste" any of this code. I wrote it all. Is it my code? No. But did I make sure to understand every line of code I re-wrote? Yes.
    Connect with me an shit:

    IG
    Twitter
    MySpace (jk)
    Snapchat: fadiastifan

  11. #10
    Smoke's Avatar
    Join Date
    Nov 2014
    Gender
    male
    Posts
    11,899
    Reputation
    2661
    Thanks
    4,610
    My Mood
    Amazed
    Been over a week since last update/bump after answers, assuming solved.

    /Closed.


    CLICK TO BUY NOW!!


    Quote Originally Posted by Liz View Post
    This is my first vouch, ever. Rapidgator account worked perfectly. Would buy in the future.

Similar Threads

  1. [Help] what is wrong with this code?
    By _corn_ in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 2
    Last Post: 12-22-2011, 12:01 PM
  2. [Help] What is wrong with this code!
    By killer660 in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 14
    Last Post: 08-01-2011, 09:55 AM
  3. [Help] What is wrong with this code?
    By IGNITE09178 in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 15
    Last Post: 07-01-2011, 03:59 AM
  4. Bad Syntax - What is wrong with this code?
    By HACKINGPIE in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 5
    Last Post: 01-19-2011, 12:12 AM
  5. What is wrong with this code?
    By t7ancients in forum C++/C Programming
    Replies: 10
    Last Post: 10-19-2009, 01:58 PM