if (Config.GetBool("combat.triggerbot.triggerbot"))
{
PlayerController playerController;
if (Config.GetBool("combat.softaim.checkfov"))
{
if (Config.GetBool("combat.softaim.dynamicfov"))
{
playerController = GetBestPlayerInFOV(Camera.main.fieldOfView + 80);
}
else
{
playerController = GetBestPlayerInFOV(Config.GetFloat("combat.softaim.fovsize"));
}
}
else
{
playerController = GetBestPlayerInFOV(Screen.width);
}
if (playerController != null)
{
Vector3 playerScreenPosition = Position.ToScreen(Players.GetHeadPosition(playerController));
WeaponModel weaponModel = LocalPlayer.GetWeaponModel();
WeaponsController weaponsController = LocalPlayer.GetWeaponsController();
if (Position.IsOnScreen(playerScreenPosition))
{
Mouse.MoveTo(playerScreenPosition, (int)Math.Round(Config.GetFloat("combat.softaim.smoothing"), 0));
int enemyPlayerID = playerController.GetInstanceID();
// Check if the enemyPlayerID is valid and not null or empty
if (enemyPlayerID != 0)
{
// Use the RPC call to fire the weapon remotely specifically on the targeted enemy
weaponsController?.TryFireWeapon();
}
}
}
}