SolvedNPC Telekill

Posts 15 of 5 · Page 1 of 1
NPC Telekill
Okay so I was working on a npc version for telekill because the way I have the regular telekill setup makes it confusing when combing them. So I have this but when i turn it on, it crashes. I have been looking at other examples and stuff but i cant figure it out. So if anyone wants to help feel free.

Code:
void cHacks::NPCTelekill( int enable)
{
	if(enable)
	{
		DWORD PositionY, PositionPointer;
		PositionPointer = (DWORD)GetModuleHandleA("ClientFX.fxd");
		PositionPointer += 0x0006BF34;

		memcpy(&PositionY,(void *)PositionPointer, 4);

		for(int i = 0; i < SFXMgr->SFXList[SFX_CHARACTER]; i++)
		{
			CharacterFX = (cCharacterFX*)SFXMgr->SFXList[SFX_CHARACTER];
			if(Main->Tools->ValidPointer(CharacterFX) && !CharacterFX->IsPlayer)
			{
				*(float*)(PositionY + 0xC8) = (CharacterFX->object->Pos.x + 75.0f);
				*(float*)(PositionY + 0xCC) = (CharacterFX->object->Pos.y + 75.0f);
				*(float*)(PositionY + 0xD0) = (CharacterFX->object->Pos.z);
			}
		}
	}
}
Well the code doesnt look wrong but I made a better solution:
Put a check for FireTeam in a GetNearestPlayer function, and just let it return the id of the character (not player!)
Then you have 1 single function for 2 features:

Code:
int ID = GetNearestIndex(false, true);
if(ID != -1)
{
	cCharacterFX *pFX = (cCharacterFX*)pSFXMgr->SFXList[SFX_CHARACTER].List[ID];
}
Quote Originally Posted by Ch40zz-C0d3r View Post
Well the code doesnt look wrong but I made a better solution:
Put a check for FireTeam in a GetNearestPlayer function, and just let it return the id of the character (not player!)
Then you have 1 single function for 2 features:

Code:
int ID = GetNearestIndex(false, true);
if(ID != -1)
{
	cCharacterFX *pFX = (cCharacterFX*)pSFXMgr->SFXList[SFX_CHARACTER].List[ID];
}
Its still crashing... Maybe my classes are wrong...
Quote Originally Posted by Skaterforeva1 View Post
Its still crashing... Maybe my classes are wrong...
I would recommend getting your target position from a bone transform result as im not sure if you can call position directly or not, cant remember because ive always done it by bone. Also remember to do what chaos said aswell as its not gonna work very well without a target calculation and you needa have .List[ID]; on the end.

Oh and for your loop:
Code:
int numplayers = SFXMgr->SFXList[SFX_CHARACTER].Num
Some Useful defines:
Code:
#define PELVIS	3
#define TORSO	5
#define HEAD	8
Code:
GetLTModel()->GetNodeTransform( fx->Object, HEAD, &Players[i].Head,  true );
Quote Originally Posted by matypatty View Post


I would recommend getting your target position from a bone transform result as im not sure if you can call position directly or not, cant remember because ive always done it by bone. Also remember to do what chaos said aswell as its not gonna work very well without a target calculation and you needa have .List[ID]; on the end.

Oh and for your loop:
Code:
int numplayers = SFXMgr->SFXList[SFX_CHARACTER].Num
Some Useful defines:
Code:
#define PELVIS	3
#define TORSO	5
#define HEAD	8
Code:
GetLTModel()->GetNodeTransform( fx->Object, HEAD, &Players[i].Head,  true );
Thanks I must have been getting the wrong target or something. It works now. @Flengo close please.
Posts 15 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Need help?