Author Topic: Cant determine if target is dead  (Read 4762 times)

0 Members and 1 Guest are viewing this topic.

Offline BlacklistedTopic starter

  • Jr. Member
  • **
  • Posts: 75
  • Activity:
    0%
  • Reputation Power: 2
  • Blacklisted has no influence.
  • Respect: +13
  • Referrals: 0
    • View Profile
Cant determine if target is dead
« on: June 11, 2016, 09:02:36 AM »
+1
I am trying to check if a target is dead or not. but the target value always return true.
Im not sure if I am using the TargetHelper class correctly or not.

Code: [Select]
namespace Test
{
    public partial class MainWindow : Window
    {
        public PlayerMobile Player = PlayerMobile.GetPlayer();
        public TargetHelper TargetHelper = TargetHelper.GetTarget();
        private Thread TestThread;
        public MainWindow()
        {
            InitializeComponent();
            TestThread = new Thread(TestIfDead);
        }

        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            TestThread.Start();
        }

        public void TestIfDead()
        {
            var target = TargetHelper.VCursorToMobile();
            do
            {
                if (target.Dead)
                {
                    this.Dispatcher.Invoke((Action)(() =>
                    {
                        tbIsDead.Text = "TARGET DIED";
                    }));
                   
                }
                else
                {
                    this.Dispatcher.Invoke((Action)(() =>
                    {
                        tbIsDead.Text = "TARGET ALIVE";
                    }));
                }
            } while (!target.Dead);
        }
    }
}

Tags: ScriptSDK