What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Cancel Trade

Status
Not open for further replies.

leonep

New Member
Joined
Jan 7, 2015
Messages
25
Reaction score
0
I found 2 event working for trade

ontradestarted
ontradedone

The problem is that i cannot find an event for trade canceled, i find only a method called CancelTrade.

I need to set a boolean for check player is trading or no like this:

public void START(Creature Obj)
{
istrading = true;
}

public void FINISH(Creature Obj)
{
istrading = false;
}

the event finish are for completed correctly trade, if some1 cancel the event FINISH does not start ..
some1 can help me ?ty
 
Code:
       bool isTrading { get; set; }
       onTradeStarted += on_TradeStart

       public void on_TradeStart(Creature obj)
       {
            var info = me.tradeInfo;
             
            isTrading = true;
           
            new Thread(tradeWatcher).Start();

            if (info.IsTradeOk == false)
            {
                PutItemInTrade("CoolItem", 100);

                if (info.isLocked == false)
                {
                    LockTrade(true);
                }
                if (info.IsTradeOk == false)
                {
                    ConfirmTrade();
                }
            }
        }

        public void tradeWatcher()
        {
            while (isTrading == true)
            {
                var info = me.tradeInfo;

                if (info.isOpened == false)
                {
                    Console.Log("User canceled the trade or something bad happened... :(");
                    isTrading = false;
                }
                Thread.Sleep(1000);
            }
        }
 
Last edited:
Status
Not open for further replies.
Back
Top