Results 1 to 9 of 9

Threaded View

  1. #1
    Phot0n's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Location
    North America
    Posts
    3
    Reputation
    10
    Thanks
    16
    My Mood
    Happy

    Cool Don't always PushToConsole

    I'm fairly new here and just got some of my own initial hacks working with help from the amazing source of information I've found in the forums. One thing I'm noticing a lot are unnecessary PTC in while loops so I thought I'd call it out since I noticed my CA would crash/exit until I fixed it.

    Example of what not to do:

    Code:
    while(true) {
       PushToConsole("...");
    }
    Some of this can be mitigated by detecting if the Console shell exists before pushing a command to the LTC. This type of checking is always good:

    Code:
    void __cdecl PushToConsole( const char* szCmd )
    {
    	DWORD dwCShell = (DWORD)GetModuleHandleA("CShell.dll");
    	if( dwCShell != NULL )
    	...

    Another case of the never-ending pushes that I see floating around the forums are when you set a flag based on a key-event (or whatever), and then either always push the command to be active or inactive:

    Code:
       bool chams = false;
    
       while(true) {
    	// Chams
    	if(GetAsyncKeyState(VK_NUMPAD1)&1) {
    		chams = !chams;
            }
            ...
    	if(chams) {
    		PushToConsole("SkelModelStencil 0");
    	} else {
    		PushToConsole("SkelModelStencil 1");
    	}
    	Sleep(100);
            ...
    }
    Those "Sleep" commands can only do so much, but you are essentially constantly pushing commands (either chams-on or chams-off) all the time. Rather, if you want something simple, then just do the command push and flag update on the key event:

    Code:
    while(true) {
    		// Chams
    		if(GetAsyncKeyState(VK_NUMPAD1)&1)
    		{
    			if(chams) {
    				PushToConsole("SkelModelStencil 0");
    			} else {
    				PushToConsole("SkelModelStencil 1");
    			}
    			chams = !chams;
    			Sleep(100);
    		}
         ...
    }
    So far I've seen better hack success and less CA exit/crashes.

    On a slight side note, I'm also seeing less exits when doing "Release" quality builds from VS2008 and packing the DLL through UPX.

    Anyways, I hope this helps. If not, then... well... hello.

    Regards,
    --Phot0n

  2. The Following 8 Users Say Thank You to Phot0n For This Useful Post:

    cosconub (09-02-2010),fvestrgenrl (09-01-2010),Gordon` (09-01-2010),lucky7 (10-03-2010),rob7601 (09-01-2010),swatfx (09-01-2010),tempta43 (09-02-2010),treeham (09-01-2010)

Similar Threads

  1. [Solved] =.= i always have a problem don't I
    By Wolfzero in forum CrossFire Help
    Replies: 39
    Last Post: 10-21-2011, 05:59 PM
  2. For those who don't have playspan code. ( always update )
    By Osama_Farooq in forum CrossFire Tutorials
    Replies: 8
    Last Post: 08-07-2010, 01:20 AM
  3. Replies: 6
    Last Post: 12-08-2008, 12:57 PM
  4. [Release] Instantkill/Always headshot
    By hjerherjdsd in forum WarRock - International Hacks
    Replies: 171
    Last Post: 12-10-2006, 07:49 AM