This is a very simple example & forward assault is the easiest game I did it on.
It can be modified to work on other games.
Note: This is iOS source code, it can be modified to work on Android with a few things. But I can't be bothered to also check this out on android.
	
	
	
		
If you use this source in hacks, I'd appreciate actual credits.
	
		
			
		
		
	
				
			It can be modified to work on other games.
Note: This is iOS source code, it can be modified to work on Android with a few things. But I can't be bothered to also check this out on android.
		C++:
	
	// Don't worry to much about this, you just need this for location handling.
class Vector3 {
public:
  float x;
  float y;
  float z;
  Vector3() : x(0), y(0), z(0) {}
  Vector3(float x1, float y1, float z1) : x(x1), y(y1), z(z1) {}
  Vector3(const Vector3 &v);
  ~Vector3();
};
Vector3::Vector3(const Vector3 &v) : x(v.x), y(v.y), z(v.z) {}
Vector3::~Vector3() {}
/************************************************
Function pointers that will be used in this hack.
*************************************************/
//public Transform get_transform() ---> Class Component
void *(*Component_GetTransform)(void *component) = (void *(*)(void *))getRealOffset(0x101F84228); 
//private void INTERNAL_set_position(Vector3 value) ---> Class Transform
void (*Transform_INTERNAL_set_position)(void *transform, Vector3 newPosition) = (void (*)(void *, Vector3))getRealOffset(0x101FAB724);
//private void INTERNAL_get_position(out Vector3 value) --> get the object of a transform
void (*Transform_INTERNAL_get_position)(void *transform, Vector3 *out) = (void (*)(void *, Vector3 *))getRealOffset(0x101FAB7D0);
/*****************************************************
Utility functions which will help us with some checks.
******************************************************/
// Utility function to get a players location.
Vector3 GetPlayerLocation(void *player) {
  Vector3 location;
  Transform_INTERNAL_get_position(Component_GetTransform(player), &location);
  return location; 
}
// Utility function to get a players health
float GetPlayerHealth(void *player) {
  //private float FEHAJLBCGIN; // 0x1EC
  return *(float*)((uint64_t)player + 0x1EC);
}
// Utility function to check if a enemy is dead
bool isPlayerDead(void *player) {
  if(GetPlayerHealth(player) < 1) {
    return true;
  }
  return false;
}
// Utility function to get a players team number
int GetPlayerTeam(void *player) {
  //private int BMFGOOEECIC; // 0x210 --> Player
  return *(int*)((uint64_t)player + 0x210);
}
//Creating a null objects for enemy & my player. It will be asigned later inside the actual hook.
void *enemyPlayer = NULL;
void *myPlayer = NULL;
// Hook code
void(*old_Player_Update)(void *player);
void Player_Update(void *player) {
  //public bool isMine; // 0xCC
  bool isMine = *(bool*)((uint64_t)player + 0xCC);
  //getting my player
  if(isMine) {
    myPlayer = player;
  }
  // getting enemy player by checking whether the other players team is the same as mine
  if(myPlayer) {
    if(GetPlayerTeam(myPlayer) != GetPlayerTeam(player)) {
      enemyPlayer = player;
    }   
  }
  /*********************
    TELE KILL FEATURE
  **********************/
  // Checking if enemyPlayer object is not null
  if(enemyPlayer) {
    // checking if it's not dead, if it is enemyPlayer is NULL & it should look for a new one.
    if(!isPlayerDead(enemyPlayer)) {
      if([switches isSwitchOn:@"Teleport to Enemy"]) {
        Vector3 enemyLocation = GetPlayerLocation(enemyPlayer);
        // You can mod these values to your liking 
        Transform_INTERNAL_set_position(Component_GetTransform(myPlayer), Vector3(enemyLocation.x, enemyLocation.y, enemyLocation.z - 1));
      }     
    } else {
      enemyPlayer = NULL;
      return;
    }
  }
  old_Player_Update(player);
}
//private void Update(); --> Class: Player (bigger one)
HOOK(0x101743A8C, Player_Update, old_Player_Update);
	If you use this source in hacks, I'd appreciate actual credits.