Quick C++ Question

Posts 1–15 of 17 · Page 1 of 2
Quick C++ Question
Hello, I tried to make a quick dll
Isn't this suposed to work?

Code:
while(1)
   {
	  DWORD dwPlayerPtr = *(DWORD*)0xCCB670;
	*(float*)(dwPlayerPtr+0x2C) = 60;

      Sleep(500);
   }
what r u asking right now? havnt u tried it?
Code:
while(1)
{
Is a loop.

Why are you doing a loop? If you are doing memory hacks, just do it in DIP.
Quote Originally Posted by Henry Chang View Post
Code:
while(1)
{
Is a loop.

Why are you doing a loop? If you are doing memory hacks, just do it in DIP.
im looping cos i don't want it the adress the be written only once.
Quote Originally Posted by Henry Chang View Post
Code:
while(1)
{
Is a loop.

Why are you doing a loop? If you are doing memory hacks, just do it in DIP.
DrawIndexedPrimitive has NOTHING to do with memory hacks.

A loop works just fine, but if I were him i'd move the DWORD a = (DWORD*)0xAAAAAAA outside the loop, for performance reasons.

Quote Originally Posted by Pixipixel_ View Post
Don't loop. Just use the "if" statement, it's enough But the code is wrong
Should be like this :

Code:
int hack = 1;

if(hack)
{
DWORD dwPlayerPtr = *(DWORD*)0x00CCB670 ;
if(dwPlayerPtr != 0) //It check if we're ingame :D
{
*(float*)(dwPlayerPtr+0x2C) = 60;
}
}



Have fun.



Pixi.
No...
Using an if statement is not enough if he wants to constantly write it to memory...
Also a DWORD(which is a typedef for unsigned long) is not the same as a float.
this is not the right section to put this
Don't loop. Just use the "if" statement, it's enough But the code is wrong
Should be like this :

Code:
int hack = 1;

if(hack)
{
DWORD dwPlayerPtr = *(DWORD*)0x00CCB670 ;
if(dwPlayerPtr != 0) //It check if we're ingame :D
{
*(float*)(dwPlayerPtr+0x2C) = 60;
}
}



Have fun.



Pixi.
Can somebody confirm the adresses and if this should work for WarRock, cos I can't think of anything i'm missing.

Code:
#include <windows.h>
#include <stdio.h>



    //  DWORD *blah = (DWORD*)0x458468;
    //  *(int*)blah = 4;

 DWORD dwPlayerPtr = *(DWORD*)0xCCB670;
 
void TheHacks() //Hack Thread
{
   while(1)
   {
	   *(float*)(dwPlayerPtr+0x2C) = 60;
	 Sleep(50);
   }

}





BOOL WINAPI DllMain(HINSTANCE module, DWORD dwReason, LPVOID lpvReserved)
{
   if(dwReason == DLL_PROCESS_ATTACH)
   {
      CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)TheHacks, NULL, NULL, NULL); //create the new Thread
   }
   return TRUE;
}
Quote Originally Posted by apezwijn View Post
Can somebody confirm the adresses and if this should work for WarRock, cos I can't think of anything i'm missing.

Code:
#include <windows.h>
#include <stdio.h>



    //  DWORD *blah = (DWORD*)0x458468;
    //  *(int*)blah = 4;

 DWORD dwPlayerPtr = *(DWORD*)0xCCB670;
 
void TheHacks() //Hack Thread
{
   while(1)
   {
	   *(float*)(dwPlayerPtr+0x2C) = 60;
	 Sleep(50);
   }

}





BOOL WINAPI DllMain(HINSTANCE module, DWORD dwReason, LPVOID lpvReserved)
{
   if(dwReason == DLL_PROCESS_ATTACH)
   {
      CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)TheHacks, NULL, NULL, NULL); //create the new Thread
   }
   return TRUE;
}
You aren't checking if you are in game. Which would most likely make it crash!

Code:
DWORD iInGame = *(DWORD*)PlayerPointer;
if(iInGame != 0)
{
// stuff!
}
Quote Originally Posted by Henry Chang View Post
You aren't checking if you are in game. Which would most likely make it crash!

Code:
DWORD iInGame = *(DWORD*)PlayerPointer;
if(iInGame != 0)
{
// stuff!
}
I've added that and it's still not working.

Code:
DWORD dwPlayerPtr = *(DWORD*)0xCCB670;
 DWORD iInGame = *(DWORD*)dwPlayerPtr;
void TheHacks() //Hack Thread
{
   while(1)
   {
	   if (iInGame != 0){
	   *(float*)(dwPlayerPtr+0x2C) = 60;
	   }
	 Sleep(50);
   }

}
Try the following:

Code:
#include <windows.h>
#include <stdio.h>
DWORD dwPlayerPtr;
 
void TheHacks() //Hack Thread
{
   while(*dwPlayerPtr == 0)
   {
      Sleep(1000);
   }
   while(1)
   {
	   *(int*)(dwPlayerPtr+0x2C) = 60; // 60 is an int ^^
	 Sleep(50);
   }

}





BOOL WINAPI DllMain(HINSTANCE module, DWORD dwReason, LPVOID lpvReserved)
{
   if(dwReason == DLL_PROCESS_ATTACH)
   {
       dwPlayerPtr = /***/(DWORD*)0xCCB670; // ?
      CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)TheHacks, NULL, NULL, NULL); //create the new Thread
   }
   return TRUE;
}
haven't checked for errors and typed in a reply.
Quote Originally Posted by Hell_Demon View Post
Try the following:

Code:
#include <windows.h>
#include <stdio.h>
DWORD dwPlayerPtr;
 
void TheHacks() //Hack Thread
{
   while(*dwPlayerPtr == 0)
   {
      Sleep(1000);
   }
   while(1)
   {
	   *(int*)(dwPlayerPtr+0x2C) = 60; // 60 is an int ^^
	 Sleep(50);
   }

}





BOOL WINAPI DllMain(HINSTANCE module, DWORD dwReason, LPVOID lpvReserved)
{
   if(dwReason == DLL_PROCESS_ATTACH)
   {
       dwPlayerPtr = /***/(DWORD*)0xCCB670; // ?
      CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)TheHacks, NULL, NULL, NULL); //create the new Thread
   }
   return TRUE;
}
haven't checked for errors and typed in a reply.

I'm a noob and all, so I have no idea what this means, but these are the errors that Dev c++ kicked back to me.

In function `void TheHacks()':

invalid type argument of `unary *'

In function `BOOL DllMain(HINSTANCE__*, DWORD, void*)':

WarRock.cpp invalid conversion from `DWORD*' to `DWORD'

[Warning] passing NULL used for non-pointer converting 2 of `void* CreateThread(_SECURITY_ATTRIBUTES*, DWORD, DWORD (*)(void*), void*, DWORD, DWORD*)'

[Warning] passing NULL used for non-pointer converting 5 of `void* CreateThread(_SECURITY_ATTRIBUTES*, DWORD, DWORD (*)(void*), void*, DWORD, DWORD*)'


This may help you guys out, or maybe i'm just getting errors because I have no clue what i'm doing and shouldn't be trying to compile someone elses code.
Quote Originally Posted by ilovecookies View Post
I'm a noob and all, so I have no idea what this means, but these are the errors that Dev c++ kicked back to me.
wait its not even your code lol @ copy paster.
Did you make it into a .cpp file or a .dll file? Make a new project and select an empty project and when prompted select .dll...
Okay, now I see the addresses and offsets you are trying to make a stamina hack?

Here is mine.

[php]if( g_uiStamina == 1) // Full
{
DWORD dwPlayerPointer = *(DWORD*)ADR_PLAYERPOINTER;
if(dwPlayerPointer != NULL) // < -- IsInGame!
{
*(float*)(dwPlayerPointer+OFS_STAMINA) = 100;
}
}[/php]
Posts 1–15 of 17 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

Need help?