HelpTriggerbot code working strangely

Posts 1–5 of 5 · Page 1 of 1
[FIXED]Triggerbot code working strangely
Here is my triggerbot function:
Code:
void TriggerBot()
{
	while (true)
	{
		if (b_trigEnabled)
		{
			MyPlayer.ReadTrig();
			for (int i = 0; i < players; i++)
			{
				PlayerList[i].ReadInformation(i);
			}
			if (!b_shotNow)
			{
				Writeint<int>((fProcess.__dwordClient + c_attack), i_dontShoot);
				//WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + c_attack), &i_dontShoot, sizeof(int), NULL);
				b_shotNow = !b_shotNow;
			}
			if (MyPlayer.crosshairID == 0)
				return;
			if (PlayerList[(MyPlayer.crosshairID - 1)].teamNum == MyPlayer.teamNum)
				return;
			if (MyPlayer.crosshairID > players)
				return;
			if (b_shotNow)
			{
				Writeint<int>((fProcess.__dwordClient + c_attack), i_Shoot);
				//cout << "wrote to: " << Read<DWORD>((fProcess.__dwordClient + c_attack));
				//WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + c_attack), &i_Shoot, sizeof(int), NULL);
				//cout << "wrote to: " << Read<DWORD>((fProcess.__dwordClient + c_attack));
				b_shotNow = !b_shotNow;
			}
		}
		Sleep(1);
	}
}
Called by main:
Code:
	thread TRIG = thread(TriggerBot);


	TRIG.join();
One thing I've noticed in my compiler (VSE 2015): When I press F7 (my toggle key) for the first time in the program, I get a message saying :
Code:
The thread 0x5674 has exited with code 0 (0x0).
If I press F7 when I am looking through an enemy, it does kill them, and also gives the message. So, I think that the thread is ending instead of going on infinitely. Are there any fixes to this?

- - - Updated - - -

//EDIT: Solved, gained solution.
Posting the solition in case anyone is interested:

Prevent the thread from exiting by using the continue keyword instead of return.
Why is every noob using thread.join? Take a look on MSDN to see what that actually does.
you gotta use TRIG.detach not join
/Solved & closed.
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us