Results 1 to 10 of 10
  1. #1
    antep2727's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Posts
    744
    Reputation
    10
    Thanks
    4,606
    My Mood
    Inspired

    Closing thread upon cheat's closure and getasynckeystate

    Problem 1: Whenever i close my cheat the threads are still running, thus it still reads and writes to the memory.
    Problem 2: I want to turn cheat features on and off when pressing a Key. It works, but i can only turn them on and not turn them off anymore.

    Code:

    main.cpp

    Code:
    void main()
    
    {
    	
    	Mem.Process("csgo.exe");
    	Client = Mem.Module("client.dll");
    	
    	
    	
    	thread NoFlash_thread = thread(NoFlash);
    	
    	
    
    	NoFlash_thread.join();
    	
    }
    	
    void NoFlash()
    {
    	
    	
    	while (true)
    	{
    		if (GetAsyncKeyState(VK_F1) & 0x8000){
    
    			flashshow = !flashshow;
    		}
    		if (flashshow)
    		{
    
    
    		// read and write
    		
    
    	}
    		Sleep(1);
    		
    	}
    }

  2. #2
    WasserEsser's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    735
    Reputation
    174
    Thanks
    677
    My Mood
    Busy
    std::thread::join is the correct way to make sure your threads aren't running anymore when the executable closes.
    If you still have problems, you're doing something wrong.

    Your thread is running at a fast iteration rate, which means that once you press the button that triggers the GetAsyncKeyState, you'll likely hold the button for more than one iteration of your thread. This means that the variable you're using to enable or disable the features is getting switched multiple times. To prevent that from happening, add a sleep after flashshow = !flashshow; of about 1000 milliseconds. You're also bitmasking the GetAsyncKeyState result with 0x8000, which is the exact opposite of what you want. You want to know if you pressed the key, not if you're holding the key ( aka pressed since last call ).
    Last edited by WasserEsser; 07-11-2016 at 08:49 AM.

  3. #3
    antep2727's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Posts
    744
    Reputation
    10
    Thanks
    4,606
    My Mood
    Inspired
    I added the sleep and GetAsyncKeyState(VK_F1), but it still doesnt work. What am i doing wrong?

  4. #4
    WasserEsser's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    735
    Reputation
    174
    Thanks
    677
    My Mood
    Busy
    Quote Originally Posted by antep2727 View Post
    I added the sleep and GetAsyncKeyState(VK_F1), but it still doesnt work. What am i doing wrong?
    Does your cheat not work? Your threading? Your game? Your no flash? You gotta be specific when you say "it doesn't work".

    If you're talking about toggleing the no flash feature, i hope you know that the game doesn't rewrite m_flFlashMaxAlpha, which means that you have to rewrite it back to 255 if you want to get flashed again ( if you're using m_flFlashMaxAlpha ).

  5. #5
    antep2727's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Posts
    744
    Reputation
    10
    Thanks
    4,606
    My Mood
    Inspired
    Quote Originally Posted by WasserEsser View Post
    Does your cheat not work? Your threading? Your game? Your no flash? You gotta be specific when you say "it doesn't work".

    If you're talking about toggleing the no flash feature, i hope you know that the game doesn't rewrite m_flFlashMaxAlpha, which means that you have to rewrite it back to 255 if you want to get flashed again ( if you're using m_flFlashMaxAlpha ).
    That seems to be the problem lol

    One more question:

    Whenever i leave a game and back to lobby sometimes the game crashes. Could the reason be because i am not checking if i am connected to the game ( ConnectedPlayer == 6) and the cheats tries to write to memory?
    But if i am in matchmaking lobby i can play endless game and it will never crash.
    Last edited by antep2727; 07-11-2016 at 09:36 AM.

  6. #6
    WasserEsser's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    735
    Reputation
    174
    Thanks
    677
    My Mood
    Busy
    Quote Originally Posted by antep2727 View Post
    That seems to be the problem lol

    One more question:

    Whenever i leave a game and back to lobby sometimes the game crashes. Could the reason be because i am not checking if i am connected to the game ( ConnectedPlayer == 6) and the cheats tries to write to memory?
    But if i am in matchmaking lobby i can play endless game and it will never crash.
    Make sure to check if the local player address is valid by checking it against null.

    Code:
    if ( LocalPlayer ) // do stuff
    Last edited by WasserEsser; 07-11-2016 at 09:43 AM.

  7. #7
    gauthier08's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    175
    Reputation
    10
    Thanks
    12
    Quote Originally Posted by antep2727 View Post
    That seems to be the problem lol

    One more question:

    Whenever i leave a game and back to lobby sometimes the game crashes. Could the reason be because i am not checking if i am connected to the game ( ConnectedPlayer == 6) and the cheats tries to write to memory?
    But if i am in matchmaking lobby i can play endless game and it will never crash.

    If you think that this is true, which i doubt, you could use this:
    Code:
    void InGame()
    {
    	while (true)
    	{
    		DWORD InGame = engine.InGame(); //engine pointer + ingame offset
    		if (InGame == 0)
    		{
    			Sleep(1000); //
    			//cout << "not ingame\n";
    			return;
    		}
    
    		//cout << "ingame";
    		break;
    	}
    }
    this is what i use to check if im ingame...

  8. #8
    WasserEsser's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    735
    Reputation
    174
    Thanks
    677
    My Mood
    Busy
    Quote Originally Posted by gauthier08 View Post
    If you think that this is true, which i doubt, you could use this:
    Code:
    void InGame()
    {
    	while (true)
    	{
    		DWORD InGame = engine.InGame(); //engine pointer + ingame offset
    		if (InGame == 0)
    		{
    			Sleep(1000); //
    			//cout << "not ingame\n";
    			return;
    		}
    
    		//cout << "ingame";
    		break;
    	}
    }
    this is what i use to check if im ingame...
    If you're checking signonstate, you should either be checkig if it's >= SIGNONSTATE_CONNECTED && <= SIGNONSTATE_FULL or check if it's equal to SIGNONSTATE_FULL.

    https://******.com/LestaD/SourceEngi...rotocol.h#L159

  9. #9
    antep2727's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Posts
    744
    Reputation
    10
    Thanks
    4,606
    My Mood
    Inspired
    This can be closed, solved all my (current xd) problems.

    Thanks everyone for helping ^^
    Last edited by antep2727; 07-11-2016 at 05:08 PM.

  10. #10
    Hunter's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Location
    Depths Of My Mind.
    Posts
    17,468
    Reputation
    3771
    Thanks
    6,159
    My Mood
    Cheerful
    /Solved & closed.
    Last edited by Hunter; 07-12-2016 at 12:22 PM.

Similar Threads

  1. [Solved] Edit Closed Thread, Rename Account and Ban Account
    By AQW#EY$%srtjhdez in forum Account Recovery & Support
    Replies: 0
    Last Post: 03-30-2016, 05:05 PM
  2. bombs away is constantly closing threads
    By MrGreyDeath in forum Combat Arms Discussions
    Replies: 8
    Last Post: 04-21-2010, 09:21 PM
  3. wat with all the close thread
    By striker2x in forum CrossFire Discussions
    Replies: 15
    Last Post: 03-18-2010, 03:59 PM
  4. 100% undetected !!! cheat for CS and CS:S !!! 14-04-2009 !!! AEQ , VAC , VAC2
    By ownermcown in forum CounterStrike (CS) 1.6 Hacks / Counter Strike: Source (CSS) Hacks
    Replies: 9
    Last Post: 05-03-2009, 03:52 PM
  5. Replies: 3
    Last Post: 10-26-2008, 08:17 PM