fuhuifhsiuhfiegbfi (06-21-2016)
Use god damn code tags.
Just like you quote people, exchange the QUOTE with CODE and put your code inbetween.
Code:#include <Windows.h> #include <iostream> #include "ProcMem.h" ProcMem Mem; DWORD ClientDllBase = 0; const DWORD dwLocalPlayer = 0x4EDF554; const DWORD dwEntityList = 0x4A4BA54; const DWORD dwForceAttack = 0x2E8BA38; const DWORD m_iHealth = 0xFC; const DWORD m_iCrossHairID = 0xAA44; const DWORD m_iTeamNum = 0xF0; const DWORD EntityLoopDistance = 0x10; void Triggerbob() { DWORD Entity = 0; DWORD LocalPlayer = Mem.Read< DWORD >(ClientDllBase + dwLocalPlayer); int CrossHairID = Mem.Read< int >(LocalPlayer + m_iCrossHairID); if (Entity = Mem.Read< DWORD >(ClientDllBase + dwEntityList + CrossHairID * EntityLoopDistance) && Mem.Read< int >(Entity + m_iHealth) > 0 && Mem.Read< int >(Entity + m_iTeamNum) != Mem.Read< int >(LocalPlayer + m_iTeamNum)) Mem.Write< int >(ClientDllBase + dwForceAttack, 6); } int main() { Mem.Process("csgo.exe"); ClientDllBase = Mem.Module("client.dll"); while ("This is pasted" != "off of MPGH") { Triggerbob(); Sleep(1); } return EXIT_SUCCESS; }
Try the above code again, because i don't see any problem right now.
fuhuifhsiuhfiegbfi (06-21-2016)
After some 'testing' it appears the problem is something to do with the if statement. The line to attack works fine but the if statement does not.
To test this I used using namespace std;(for the test only) and put within the if condition to cout a random piece of text AND the attack but to my not-so suprise , the text was nout outputted to the console either so it must be the if statement right?
fuhuifhsiuhfiegbfi (06-21-2016)
The code you posted still , for some reason , does not work. I am running csgo in windowed mode. Coudl that be it?
Also what I tried to do:
I just put while 1 is equal to 1 then write attack. It worked becuase as soon as I went in game the gun just started spraying making it obvious that the command to attack worked. I did this in the main function before calling trigger bot.
For the cout thing. I did this
Also how do I use quote tags?
if (Entity = Mem.Read< DWORD >(ClientDllBase + dwEntityList + CrossHairID * EntityLoopDistance)
&& Mem.Read< int >(Entity + m_iHealth) > 0
&& Mem.Read< int >(Entity + m_iTeamNum) != Mem.Read< int >(LocalPlayer + m_iTeamNum))
cout << "display something if this worked" << endl; //except this did not occur when I aimed at an enemy
Mem.Write< int >(ClientDllBase + dwForceAttack, 6);
}
Last edited by fuhuifhsiuhfiegbfi; 06-21-2016 at 03:53 PM.
No.
This code shouldn't even compile, since you're lacking an opening brace.
Try this:
Code:#include <Windows.h> #include <iostream> #include "ProcMem.h" ProcMem Mem; DWORD ClientDllBase = 0; const DWORD dwLocalPlayer = 0x4EDF554; const DWORD dwEntityList = 0x4A4BA54; const DWORD dwForceAttack = 0x2E8BA38; const DWORD m_iHealth = 0xFC; const DWORD m_iCrossHairID = 0xAA44; const DWORD m_iTeamNum = 0xF0; const DWORD EntityLoopDistance = 0x10; void Triggerbob() { DWORD Entity = 0; DWORD LocalPlayer = Mem.Read< DWORD >(ClientDllBase + dwLocalPlayer); int CrossHairID = Mem.Read< int >(LocalPlayer + m_iCrossHairID); if (Entity = Mem.Read< DWORD >(ClientDllBase + dwEntityList + CrossHairID * EntityLoopDistance) && Mem.Read< int >(Entity + m_iHealth) > 0 && Mem.Read< int >(Entity + m_iTeamNum) != Mem.Read< int >(LocalPlayer + m_iTeamNum)) Mem.Write< int >(ClientDllBase + dwForceAttack, 6); } int main() { Mem.Process("csgo.exe"); ClientDllBase = Mem.Module("client.dll"); while ("This is pasted" != "off of MPGH") { Triggerbob(); Sleep(1); } return EXIT_SUCCESS; }
Just like you quote.
[ CODE ] //MY CODE HERE [ /CODE ]
Just that there are no spaces between [, CODE, ], [, /CODE and ].
fuhuifhsiuhfiegbfi (06-21-2016)
The closing brace was to end the triggerbob function.
Also I tried that code and it compiled but still it did not work.
Are you sure those offsets are right? Because I just dumped them again now and for dwLocalPlayer is 0x00A30504 but in the code you posted the offset for local player is 0x4EDF554?
I wasn't talking about the closing brace. You can only have one statement for an if statement without braces.
If your code compiled, then your compiler saw the Mem.Write statement as not part of the if statement, which would have meant that it should've shot every time, without the if statement having any effect onto it.Code:if ( a ) return; // works if ( b ) bla( ); return; // doesn't work if ( c ) { bla( ); return; // works }
They are correct, the LocalPlayer pointer i'm using is a different pointer which points to the same address.
fuhuifhsiuhfiegbfi (06-21-2016)
I see. So the if statement would need braces?
Like this?Code:if (Entity = Mem.Read< DWORD >(ClientDllBase + dwEntityList + CrossHairID * EntityLoopDistance) && Mem.Read< int >(Entity + m_iHealth) > 0 && Mem.Read< int >(Entity + m_iTeamNum) != Mem.Read< int >(LocalPlayer + m_iTeamNum)){ Mem.Write< int >(ClientDllBase + dwForceAttack, 6); }
Because this is the only way I can add them without an error.
But even without braces it does not shoot at the enemy?
The last thing i can think of, try moving Entity = Mem.Read< DWORD >(ClientDllBase + dwEntityList + CrossHairID * EntityLoopDistance) out of the if statement and move it at the line above.
Code:#include <Windows.h> #include <iostream> #include "ProcMem.h" ProcMem Mem; DWORD ClientDllBase = 0; const DWORD dwLocalPlayer = 0x4EDF554; const DWORD dwEntityList = 0x4A4BA54; const DWORD dwForceAttack = 0x2E8BA38; const DWORD m_iHealth = 0xFC; const DWORD m_iCrossHairID = 0xAA44; const DWORD m_iTeamNum = 0xF0; const DWORD EntityLoopDistance = 0x10; void Triggerbob() { DWORD Entity = 0; DWORD LocalPlayer = Mem.Read< DWORD >(ClientDllBase + dwLocalPlayer); int CrossHairID = Mem.Read< int >(LocalPlayer + m_iCrossHairID); Entity = Mem.Read< DWORD >(ClientDllBase + dwEntityList + CrossHairID * EntityLoopDistance) if (Mem.Read< int >(Entity + m_iHealth) > 0 && Mem.Read< int >(Entity + m_iTeamNum) != Mem.Read< int >(LocalPlayer + m_iTeamNum)) Mem.Write< int >(ClientDllBase + dwForceAttack, 6); } int main() { Mem.Process("csgo.exe"); ClientDllBase = Mem.Module("client.dll"); while ("This is pasted" != "off of MPGH") { Triggerbob(); Sleep(1); } return EXIT_SUCCESS; }
fuhuifhsiuhfiegbfi (06-21-2016)
THANK GOD! It finally works! Thank you very much!
You don't know how long I've been trying to do this for! Thank you!
I don't know why that caused the error, since it's within the standards.
Whatever, glad that worked for you.So, to sum it up, the rules for variable declaration in a selection-statement are:
1. can only have 1 variable declared per expression,
2. the variable declaration must occur first in the expression and
3. can’t have parenthesis around declaration ( as per the syntax specification)
EDIT: It doesn't get evaluated correctly because the && operator has higher precedence, thus resulting in the bold thing to evaluate first.
Entity = Mem.Read< DWORD >(ClientDllBase + dwEntityList + CrossHairID * EntityLoopDistance) && Mem.Read< int >(Entity + m_iHealth) > 0
If you want, you can use
Code:if ((Entity = Mem.Read< DWORD >(ClientDllBase + dwEntityList + CrossHairID * EntityLoopDistance)) && Mem.Read< int >(Entity + m_iHealth) > 0 && Mem.Read< int >(Entity + m_iTeamNum) != Mem.Read< int >(LocalPlayer + m_iTeamNum)) Mem.Write< int >(ClientDllBase + dwForceAttack, 6);
Last edited by WasserEsser; 06-21-2016 at 05:21 PM.
fuhuifhsiuhfiegbfi (06-21-2016)