UnhappyI need help coding.

Posts 1–5 of 5 · Page 1 of 1
I need help coding.
Hey guys since my server closed down for the 3th time because of duping i tried to make a fix for it but im stuck.

From trade.cs
Code:
 public void CancelTrade(RealmTime time, CancelTradePacket pkt)
        {
            this.psr.SendPacket(new TradeDonePacket()
            {
                Result = 1,
                Message = "Trade cancelled."
            });
            tradeTarget.psr.SendPacket(new TradeDonePacket()
            {
                Result = 1,
                Message = "Trade cancelled."
            });

            tradeTarget.tradeTarget = null;
            tradeTarget.trade = null;
            tradeTarget.tradeAccepted = false;
            this.tradeTarget = null;
            this.trade = null;
            this.tradeAccepted = false;
            return;
        }

I wanna add it into this (clientprocessor.cs)
Code:
        public void Disconnect()
        {
            try
            {

                if (stage == ProtocalStage.Disconnected) return;
                var original = stage;
                stage = ProtocalStage.Disconnected;
                if (account != null)
                    DisconnectFromRealm();
                if (db != null && original != ProtocalStage.Ready)
                {
                    db.Dispose();
                    db = null;
                }
                skt.Close();
            }
            catch
            {
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                Console.WriteLine("Error disconnecting client, check ClientProcessor.cs");
                Console.ForegroundColor = ConsoleColor.White;
            }
        }
The idea is to make any trades stop when people try to disconnect / back to home.
And it will hotfix my main dupe exploit.

Can someone please help me.
lel, check in the tick if the owner of the player is null, if its the case, send a tradecancel packet to the tradetarget
If people don't know how to do this, just use this code:

Code:
        public void Disconnect()
        {
            try
            {
                if (stage == ProtocalStage.Disconnected) return;
                var original = stage;
                stage = ProtocalStage.Disconnected;
                if (account != null)
                    DisconnectFromRealm();
                if (db != null && original != ProtocalStage.Ready)
                {
                    db.Dispose();
                    db = null;
                }
                if (tradeTarget.tradeTarget != null)
                	psr.SendPacket(new TradeDonePacket
                {
                    Result = 1,
                    Message = "Trade cancelled."
                });
                    tradeTarget.psr.SendPacket(new TradeDonePacket
                {
                    Result = 1,
                    Message = "Trade cancelled."
                });
                    
                skt.Close();
            }
            catch (Exception e)
            {
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                Console.WriteLine("Error disconnecting client, check ClientProcessor.cs");
                Console.ForegroundColor = ConsoleColor.White;
            }
        }
You can find that in wserver/clientprocessor.cs

Proof:

Quote Originally Posted by Ahl View Post
If people don't know how to do this, just use this code:

Code:
        public void Disconnect()
        {
            try
            {
                if (stage == ProtocalStage.Disconnected) return;
                var original = stage;
                stage = ProtocalStage.Disconnected;
                if (account != null)
                    DisconnectFromRealm();
                if (db != null && original != ProtocalStage.Ready)
                {
                    db.Dispose();
                    db = null;
                }
                if (tradeTarget.tradeTarget != null)
                	psr.SendPacket(new TradeDonePacket
                {
                    Result = 1,
                    Message = "Trade cancelled."
                });
                    tradeTarget.psr.SendPacket(new TradeDonePacket
                {
                    Result = 1,
                    Message = "Trade cancelled."
                });
                    
                skt.Close();
            }
            catch (Exception e)
            {
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                Console.WriteLine("Error disconnecting client, check ClientProcessor.cs");
                Console.ForegroundColor = ConsoleColor.White;
            }
        }
You can find that in wserver/clientprocessor.cs
help

Quote Originally Posted by Mitcheel View Post
help

I wouldn't care about that. It works fine on my server with those 2 errors. I might look into it later on but for now it is fine
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us