Getting the GlowObjectsMaxCount? c++ internal

Posts 1–12 of 12 · Page 1 of 1
Getting the GlowObjectsMaxCount? c++ internal
Yo guys,

Pretty new to Internal but it's going okay. I just finished my GLOW, which works fine.

Just one problem, externally, i used to do:
Code:
for (int i = 1; i < MaxPlayers; i++)
Which worked like i wanted. But internal, apperently it looks like when i loop more players than there actually are, It'll crash.
I read somewhere u can do
Code:
for (int i = 1; i < Client->GetGlowObjectsCount; i++)
My struct
Code:
	DWORD GetGlowObjectsCount()
	{
		return *(DWORD*)(GetGlowObjects + offs->xGlowObjectsCount);
	}
My offset: DWORD xGlowObjectsCount = 0x4;

If i do that, it'll glow for a second and then crash. No idea how i can make sure it won't crash if i would read 10 players in MM and 1 guy would leave -> it crashes.

Thanks in advance!
Check if the entity you're drawing the glow on is valid:
Code:
if(!entity) continue;
and also you can just loop through 10 entities instead of Client->GetGlowObjectsCount or 32 or whatever you want as long as you're checking for nullptr's
http://www.cplusplus.com/doc/tutorial/pointers/
Quote Originally Posted by affe2626 View Post
Check if the entity you're drawing the glow on is valid:
Code:
if(!entity) continue;
and also you can just loop through 10 entities instead of Client->GetGlowObjectsCount or 32 or whatever you want as long as you're checking for nullptr's
http://www.cplusplus.com/doc/tutorial/pointers/
Thanks for the response.

im currently checking these:

Code:
			if (!Entity->GetEntityList(i))
				continue;

			if (!Player->GetLocalPlayer())
				continue;
client.dll + GlowObjectBase + 0x4 is the maximum amount of objects the CUtlVector has allocated space for. It has usually allocated more space than needed, which means the number is not the current amount of objects. Use 0xC for that instead. 0xC gives you the current amount of objects in the vector.
Quote Originally Posted by WasserEsser View Post
client.dll + GlowObjectBase + 0x4 is the maximum amount of objects the CUtlVector has allocated space for. It has usually allocated more space than needed, which means the number is not the current amount of objects. Use 0xC for that instead. 0xC gives you the current amount of objects in the vector.
Thanks for the info. I changed it to 0xC but it appears to still crash. Not sure what to do now.

Thanks in advance
Quote Originally Posted by gauthier08 View Post
Not sure what to do now.
Show your code.
Quote Originally Posted by WasserEsser View Post
Show your code.
Code:
for (int i = 1; i < Client->GetGlowObjectsCount(); i++)
		{
			Sleep(5);

			float* r = reinterpret_cast<float*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0x4);
			float* g = reinterpret_cast<float*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0x8);
			float* b = reinterpret_cast<float*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0xC);
			float* a = reinterpret_cast<float*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0x10);
			bool* rwo = reinterpret_cast<bool*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0x24);
			bool* rwuo = reinterpret_cast<bool*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0x25);
			bool* chams = reinterpret_cast<bool*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0x26);
			bool* SpottedBy = reinterpret_cast<bool*>(Entity->GetEntityList(i) + offs->xBspottedByMask);
			bool* HasDefuser = reinterpret_cast<bool*>(Entity->GetEntityList(i) + offs->xHasDefuser);
			bool* IsDefusing = reinterpret_cast<bool*>(Entity->GetEntityList(i) + offs->xIsDefusing);

			if (!Entity->GetEntityList(i))
				continue;

			if (!Player->GetLocalPlayer())
				continue;


			if (!Entity->IsDormant(i))
			{
				if (Player->GetTeam() == Entity->GetEntityTeam(i))
				{
					*r = 0.f;
					*g = 0.f;
					*b = 1.f;
					*a = 0.7f;
					*rwo = true;
					*rwuo = false;
					*chams = false;
				}


				if (Player->GetTeam() != Entity->GetEntityTeam(i))
				{
					*r = 1.f;
					*g = 0.f;
					*b = 1.f;
					*a = 0.7f;
					*rwo = true;
					*rwuo = false;
					*chams = false;
				}
			}
Fairly new to internal, as you can see. Thanks in advance.
Quote Originally Posted by gauthier08 View Post
Code:
for (int i = 1; i < Client->GetGlowObjectsCount(); i++)
		{
			Sleep(5);

			float* r = reinterpret_cast<float*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0x4);
			float* g = reinterpret_cast<float*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0x8);
			float* b = reinterpret_cast<float*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0xC);
			float* a = reinterpret_cast<float*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0x10);
			bool* rwo = reinterpret_cast<bool*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0x24);
			bool* rwuo = reinterpret_cast<bool*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0x25);
			bool* chams = reinterpret_cast<bool*>(Client->GetGlowObjects() + Entity->GetGlowIndex(i) * 0x38 + 0x26);
			bool* SpottedBy = reinterpret_cast<bool*>(Entity->GetEntityList(i) + offs->xBspottedByMask);
			bool* HasDefuser = reinterpret_cast<bool*>(Entity->GetEntityList(i) + offs->xHasDefuser);
			bool* IsDefusing = reinterpret_cast<bool*>(Entity->GetEntityList(i) + offs->xIsDefusing);

			if (!Entity->GetEntityList(i))
				continue;

			if (!Player->GetLocalPlayer())
				continue;


			if (!Entity->IsDormant(i))
			{
				if (Player->GetTeam() == Entity->GetEntityTeam(i))
				{
					*r = 0.f;
					*g = 0.f;
					*b = 1.f;
					*a = 0.7f;
					*rwo = true;
					*rwuo = false;
					*chams = false;
				}


				if (Player->GetTeam() != Entity->GetEntityTeam(i))
				{
					*r = 1.f;
					*g = 0.f;
					*b = 1.f;
					*a = 0.7f;
					*rwo = true;
					*rwuo = false;
					*chams = false;
				}
			}
Fairly new to internal, as you can see. Thanks in advance.
Attach your vs debugger and show us the crash message + which line it's crashing.
Quote Originally Posted by WasserEsser View Post
Attach your vs debugger and show us the crash message + which line it's crashing.
Don't really know how to do that, but i'll look on how to. But, isn't the problem that i'm trying to read more clients than there are? because if i do i < 10 or something. It works fine. Just there you're with the problem, if a player leaves, (it'll read more players than there are) it will crash.

Thanks for your time
put your nullptr check in top of that function
Quote Originally Posted by saun777 View Post
put your nullptr check in top of that function
Wow, it fixed it
Thanks a ton

#Solved
/Solved & closed.
Posts 1–12 of 12 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us