Help Needed, Kick Command : )

01/26/2010 04:02 -Shunsui-#1
Alrite i made this so far , Yet it kicks me insted of the user i set the name to, : )

Code:
if (Cmd[0] == "/kick")
                        {
                            Game.Character C = Game.World.CharacterFromName(Cmd[1]);
                            if (C != null)
                                GC.Disconnect();
                        }
This is for 5165 FTW!!!
01/26/2010 04:55 spare2#2
Replace with
Code:
                        if (Cmd[0] == "/kick")
                        {
                            Game.Character C = Game.World.CharacterFromName(Cmd[1]);
                            if (C != null)
                                C.MyClient.Disconnect();
                        }
01/26/2010 22:30 Basser#3
Quote:
Originally Posted by -Shunsui- View Post
Alrite i made this so far , Yet it kicks me insted of the user i set the name to, : )

Code:
if (Cmd[0] == "/kick")
                        {
                            Game.Character C = Game.World.CharacterFromName(Cmd[1]);
                            if (C != null)
                                GC.Disconnect();
                        }
This is for 5165 FTW!!!
Yes, as he said you made a small mistake.
First you make a reference to a class and call it C, and afterwards you use GC, which is a completely different class. So what you did is, you disconnected yourself, or closed a socket, not sure what GC is, and what you should do is, disconnect the Character's client. Anyway, now the more important part, make sure it saves the character before it disconnects him, not sure if this is added in the disconnect void, but check this.