Page 2 of 2

PostPosted: Sat Sep 26, 2009 11:21 am
by L. Spiro
By removing the 0-sized array.


Code: Select all
extern struct playerYAddy {
//   BYTE bBuffer[0x0];
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x24];
               FLOAT fValue;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBase = { "", 0x149E928 };



L. Spiro

PostPosted: Sat Sep 26, 2009 2:45 pm
by toffey
Thank you guys very, very much it completely solved that problem.

One last question is how can I get this to work with multiple complex addresses?

I am trying to get it to work for just two complex addresses currently, but I believe I will be using more than that in the future of my current script.

Trying to use the same code twice returns an error staing that "poBase" is already declared. If I change it to something such as "poBaseX" then it says that "playerXCoord" is an undeclared identifier (Line: 45).

I've tried declaring playerXCoord (and playerYCoord) before the functions, but it then causes the script to have absolutely no effect in-game.

Sorry for all of the questions.

My Code with the first as "poBaseX":
Code: Select all
float saved_X_Loc = 0;
float saved_Y_Loc = 0;
float saved_X_Loc2 = 0;
float saved_Y_Loc2 = 0;

extern struct playerXAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x1C];
               FLOAT playerXCoord;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBaseX = { "", 0x149E928 };


void On_Open_CLIENT_EXE( DWORD dw1, DWORD dw2 ) {   
  poBaseX->poObj->poObj->poObj->playerXCoord = 0;
}

extern struct playerYAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x24];
               FLOAT playerYCoord;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBase = { "", 0x149E928 };


void On_Open_CLIENT_EXE( DWORD dw1, DWORD dw2 ) {   
  poBase->poObj->poObj->poObj->playerYCoord = 0;
}

VOID On_HK_CLIENT_EXE_1( DWORD dw1, DWORD dw2 ) {      //Save Location1
   saved_X_Loc = playerXCoord;
   saved_Y_Loc = playerYCoord;
   
   Sleep(10);
}


Edit: Fixed a typo in the code

PostPosted: Sat Sep 26, 2009 3:11 pm
by CoMPMStR
First of all, I think you only need one void On_Open_CLIENT_EXE declaration:

Code: Select all
void On_Open_CLIENT_EXE( DWORD dw1, DWORD dw2 ) {   
  poBaseX->poObj->poObj->poObj->playerXCoord = 0;
  poBase->poObj->poObj->poObj->playerYCoord = 0;
}


Secondly, the reason it tells you that poBase is already declared is because it is. poBase is declared as a pointer to the playerXAddy extern struct so it can't be declared as something else (same with poBaseX or any other global variable). poObj is a pointer declared in a seperate struct each time which is why you can use it like that without any problems. You would have to set one to poBaseX and the other to poBaseY.

Lastly, you have to call the same code to set the saved_X_Loc as you do to set it initially.

Code: Select all
saved_X_Loc = poBaseX->poObj->poObj->poObj->playerXCoord;

PostPosted: Sat Sep 26, 2009 4:05 pm
by toffey
Thanks for the help again, everything is working perfectly now. I could have sworn that I tried that, but apparently not.

I had forgotten to switch "poBaseX->poObj...." back with the player coords after CTRL-Z'ing for a while to get rid of some changes. Definitely clarified it though so I appreciate that.

PostPosted: Sat Sep 26, 2009 5:05 pm
by L. Spiro
Do not waste your time making a new structure for every member that is already on the same structure.

Code: Select all
extern struct playerXAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x1C];
               FLOAT playerXCoord;
               FLOAT playerYCoord;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBase = { "", 0x149E928 };




Code: Select all
void On_Open_CLIENT_EXE( DWORD dw1, DWORD dw2 ) {   
  poBase->poObj->poObj->poObj->playerXCoord = 0;
  poBase->poObj->poObj->poObj->playerYCoord = 0;
}



L. Spiro

PostPosted: Sat Sep 26, 2009 5:47 pm
by toffey
I'm slightly confused. Where would I put the "BYTE bBuffer[0x1C];" in the structure for the X Coordinate (Y Coordinate uses "BYTE bBuffer[0x24])?

Code: Select all
extern struct playerXAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x1C];
               FLOAT playerXCoord;
               BYTE bBuffer[0x24];
               FLOAT playerYCoord;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBaseX = { "", 0x149E928 };

The code above then causes "saved_X_Loc" to give an error saying that it is an undeclared identifier even though it is already defined. Commenting that line makes the error occur with the next variable, and so on.


This is the code I have made from CoMPMStR's suggestions:
Code: Select all
float saved_X_Loc;
float saved_Y_Loc;
float saved_X_Loc2;
float saved_Y_Loc2;

extern struct playerXAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x1C];     // <----- [0x1C] for the X Coordinate
               FLOAT playerXCoord;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBaseX = { "", 0x149E928 };

extern struct playerYAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x24];     // <----- [0x24] for the X Coordinate
               FLOAT playerYCoord;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBaseY = { "", 0x149E928 };


VOID On_Open_CLIENT_EXE( DWORD dw1, DWORD dw2 ) {   
  poBaseY->poObj->poObj->poObj->playerYCoord = 0;
  poBaseX->poObj->poObj->poObj->playerXCoord = 0;
}

VOID On_HK_CLIENT_EXE_1( DWORD dw1, DWORD dw2 ) {      //Save Location1
   saved_X_Loc = poBaseX->poObj->poObj->poObj->playerXCoord;
   saved_Y_Loc = poBaseY->poObj->poObj->poObj->playerYCoord;   
   Sleep(10);
}

PostPosted: Sat Sep 26, 2009 6:15 pm
by CoMPMStR
I don't think it would be 0x1C then 0x24 in the same struct.

Code: Select all
extern struct playerAddy {
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer0[0x1C];
               FLOAT playerXCoord; //1C+0
               BYTE bBuffer1[4]; //1C+4=0x20
               FLOAT playerYCoord; //1C+8=0x24
         } * poObj;
         } * poObj;
      } * poObj;
} * poBase = { "", 0x149E928 };


Since 0x24 is 8 bytes away from 0x1C you should only need 4 buffer bytes in between for it to work. Also you can't declare bBuffer twice in the same struct.

PostPosted: Sat Sep 26, 2009 7:42 pm
by toffey
Ah, now I get it. Thanks again guys :D