[Release] Extremely basic (but working/bugless) C# Source

06/15/2009 08:02 Zeroxelli#166
No idea, never used this source.
06/15/2009 08:36 ih8you#167
fast reply.... Anyway Since i got it to work thanks to you I thought id make a console command that saves chars. i got this right now

Code:
}
        public static void Parse(GameClient Client, string From, string To, string Msg)
        {
            string[] args = Msg.Split(' ');
            args[0] = args[0].ToLower();

            switch (args[0])
            {
                case ".save": // First attampt
                    {
                        SaveCharacter(Client);
                        Console.WriteLine("Characters Have Been Saved");
                        break;
                    }
Where in Database.cs Do i put this
06/15/2009 09:13 Zeroxelli#168
Again, don't know the source. I'd assume PacketHandler, PacketParser, or ChatHandler would contain commands though
06/15/2009 09:24 ih8you#169
yea maybe =/ you should have alook at it =P
06/16/2009 00:58 LordSesshomaru#170
If you are using Rev 3+ Commands are exucted through the Commands.cs. Anyone could see this plainly. Sorry for lack of helping having a full-time job and full time gf is hard to work on my source. Tho i broke off of hybrids base to my own base. I still implemented some of hybrids theories and Idea's.

Commands are handled in the Commands.cs file add you commands there example

Code:
      public static void Parse(GameClient Client, string From, string To, string Msg)
        {
            try
            {
                string[] args = Msg.Split(' ');
                args[0] = args[0].ToLower();

                CmdLog.WriteLine(Client.Entity.Name + ": " + Msg + " (" + DateTime.Now.ToString() + ")");
                CmdLog.Flush();

                switch (args[0])
                {
                    case "@heal":
                        {
                            Client.Entity.Hitpoints = Client.Entity.MaxHitpoints;
                            Sync.HP(Client);
                            break;
                        }
}
               case "@save":
                        {
                            Database.SaveCharacter(Client);
                            Message.Send(Client, "Character saved!", 0x00FFFFFF, MessagePacket.TopLeft);
                            break;
                        }
                    case "@scroll":
                        {
                            Client.PrevMap = Client.Entity.MapID;
                            switch (args[1].ToLower())
                            {
                                case "tc":
                                    Client.Teleport(1002, 431, 379);
                                    break;
                                case "pc":
                                    Client.Teleport(1011, 190, 271);
                                    break;
                                case "am":
                                    Client.Teleport(1020, 567, 576);
                                    break;
                                case "dc":
                                    Client.Teleport(1000, 500, 650);
                                    break;
                                case "bi":
                                    Client.Teleport(1015, 723, 573);
                                    break;
                                case "ma":
                                    Client.Teleport(1036, 200, 200);
                                    break;
                                case "arena":
                                    Client.Teleport(1005, 52, 69);
                                    break;
                            }
                            break;
                        }
                }
            }
            catch (Exception e)
            {
                Client.Send(new MessagePacket("[Command Error] " + e.Message, 0x00FF0000, MessagePacket.TopLeft));
                Console.WriteLine(e);
            }
        }
    }
}
If you dont have the command.cs file please download Rev3 or Tao's rev , You always want to use try-catch blocks with commands and things , The way a try-catch block works if some-thing goes wrong with the command or code it will catch the code meaning it will go to the catch and still continue with the code , Example for @item command
06/16/2009 08:29 ih8you#171
So even console commands go in commands.cs. like .close will close the server even if its it commands?
06/16/2009 08:46 kinshi88#172
Quote:
Originally Posted by ih8you View Post
So even console commands go in commands.cs. like .close will close the server even if its it commands?
No.
06/16/2009 09:20 alexbigfoot#173
Commands.cs include only players commands, it has nothing to do with console's command. The commands for console goes where you set the Console.ReadLine(); statment and you can do it like

string Command = Console.ReadLine();
switch(Command.ToLower())
{
case "close": Enviroment.Exit(Enviroment.ExitCode); break;
case "sendmsg": foreach(GameClient Cl in Kernel.GamePool.Values)
{
Cl.Send(new MessagePacket("Hello everyone", 0,MessagePacket.Center));
}Console.ReadLine();break;
default: Console.ReadLine(); break;
}
06/16/2009 14:02 ih8you#174
Quote:
Originally Posted by alexbigfoot View Post
Commands.cs include only players commands, it has nothing to do with console's command. The commands for console goes where you set the Console.ReadLine(); statment and you can do it like

string Command = Console.ReadLine();
switch(Command.ToLower())
{
case "close": Enviroment.Exit(Enviroment.ExitCode); break;
case "sendmsg": foreach(GameClient Cl in Kernel.GamePool.Values)
{
Cl.Send(new MessagePacket("Hello everyone", 0,MessagePacket.Center));
}Console.ReadLine();break;
default: Console.ReadLine(); break;
}
Thanks, Im used to lotf. This is a change.

Oh and u made a typo at "Enviroment" should be Environment

will that close command save the characters
06/24/2009 03:39 random321#175
what version is this server?
06/24/2009 08:07 khaledzorro1#176
Carzy-X ana ba7bk walhhy we 3arf ank hats3den fe source 5095 bas u come back kalmny 3al al yahoo [Only registered and activated users can see links. Click Here To Register...] or 0171875404
06/26/2009 03:23 ImFlamedCOD#177
random 5017

Super BUMP!!!

PHP Code:
If anyone needs help coding with hybrids source please feel free to ask i would be more than willing to help you with anything not updating it to 518thohehe 
#Merged
07/09/2009 08:13 biodrowski#178
God why cant anyone one make a source that doesnt take some of my life away to set up a server and have friends play with out bugs is that too hard to ask
07/09/2009 13:45 Kiyono#179
Quote:
Originally Posted by biodrowski View Post
God why cant anyone one make a source that doesnt take some of my life away to set up a server and have friends play with out bugs is that too hard to ask
Then get a crappy source like LOTF where everything more or less works.
07/10/2009 10:45 ImFlamedCOD#180
Quote:
Originally Posted by Kiyono View Post
Then get a crappy source like LOTF where everything more or less works.
I agree 50 % , No source is perfect, and most certain no source is better or the best. I would have to say all source have a or are a diy self deal.(do it yourself) Why people do not understand the real importance of this, and the level of programing required for this is why people call them newbs.

If your going to complain , whine , or flame about something , you just wasted 2 minutes of you life , that you could have used more productively one progressing in something. . .