Max Players

11/14/2008 10:11 boonhood3#1
I want Know how i can make My Server Max Player

loggin on it Like 200 Player

and Something more

how i can Delet the NPC Guy For make RB

can some one Give me Id and i will Delet From my Server

i Hate RB
11/14/2008 11:11 Tw3ak#2
LOL your server won't even touch anything close to 200 players no need to set a max players you'll be lucky if u can get 20 on yours:rolleyes:
11/14/2008 14:13 taguro#3
Lol, even if you did, what makes you think your server can handle 200 people without crashing?
11/14/2008 15:14 _Emme_#4
Not giving this hint for the thread starter,since he will be a loser anyways,but to all the others,this is an example on top of my head:

Lets say you want 50 people to be maximal on your server, you can do like this:

At case 74, above all the surrondme, sendmetoothers blahblah blah, something like this maybe?:

byte MaxPlayers = AMOUT;

Okay,great! Now you have MaxPlayers defined, if we should do what we said,it would be 50, right?

Okay,lets move on.

Now,what is the definiton for the All characters online? Its "World.AllChar", right? Now,we need to have an count on this,simply we do this : World.AllChar.Count , alright?

Good.

Now,we gotta check if the World.AllChar.Count is the same or above as the MaxPlayer Limit, alright? This is simple to anyone who actually knows how to code,so im not even going to mention it, you could give the stupid epvp leeching community a thanks if you're happy with that,lol.

Okay,then, we did , if allchar.count is the same as the limit or above , we drop the player of the server,like this:

SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "The server is full, please try again later! ", 2000));
MyChar.MyClient.Drop();




Note, always have the MaxPlayers one more than the real one, if you want an limit of 20 people, put the MaxPlayers to 21, since it drops the character that reach the limit that is defined.

Hope it gave you some hints and ideas!

Emme
11/14/2008 17:13 boonhood3#5
i Will Try And i Hope i Make it Work

U Are Best Man in Evrey Thread i Make u Help me

u Are Really Great Man

ty emme Again:D:D:D

and Who Answer me ur server will be max 20

ty i Just Say Like 200 ppl not i want my server 200 ppl

That Good For me But Bad for u
11/15/2008 01:08 Korvacs#6
Quote:
Originally Posted by EmmeTheCoder View Post
Not giving this hint for the thread starter,since he will be a loser anyways,but to all the others,this is an example on top of my head:

Lets say you want 50 people to be maximal on your server, you can do like this:

At case 74, above all the surrondme, sendmetoothers blahblah blah, something like this maybe?:

byte MaxPlayers = AMOUT;

Okay,great! Now you have MaxPlayers defined, if we should do what we said,it would be 50, right?

Okay,lets move on.

Now,what is the definiton for the All characters online? Its "World.AllChar", right? Now,we need to have an count on this,simply we do this : World.AllChar.Count , alright?

Good.

Now,we gotta check if the World.AllChar.Count is the same or above as the MaxPlayer Limit, alright? This is simple to anyone who actually knows how to code,so im not even going to mention it, you could give the stupid epvp leeching community a thanks if you're happy with that,lol.

Okay,then, we did , if allchar.count is the same as the limit or above , we drop the player of the server,like this:

SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "The server is full, please try again later! ", 2000));
MyChar.MyClient.Drop();




Note, always have the MaxPlayers one more than the real one, if you want an limit of 20 people, put the MaxPlayers to 21, since it drops the character that reach the limit that is defined.

Hope it gave you some hints and ideas!

Emme
Why do any of that?

Just goto your connection system, and just make the array that stores the active connections have a limit of 200 >_>
11/15/2008 01:34 _Emme_#7
I find this simple enough, no need to change it in my opinion, wont use too much memory and space.

Quote:
byte MaxAmout = 20;
if (World.AllChars.Count == MaxAmout + 1)
{
MyChar.Save();
MyChar.MyClient.Drop();
}
Rest is just writelines,nothing important.
11/15/2008 08:24 boonhood3#8
Quote:
Originally Posted by Korvacs View Post
Why do any of that?

Just goto your connection system, and just make the array that stores the active connections have a limit of 200 >_>
ty emme i Will Learn Some C# and try

But Kor Where i can Find Connection

or tell me how i can Create
11/15/2008 09:19 alexbigfoot#9
Quote:
Originally Posted by EmmeTheCoder View Post
Not giving this hint for the thread starter,since he will be a loser anyways,but to all the others,this is an example on top of my head:

Lets say you want 50 people to be maximal on your server, you can do like this:

At case 74, above all the surrondme, sendmetoothers blahblah blah, something like this maybe?:

byte MaxPlayers = AMOUT;

Okay,great! Now you have MaxPlayers defined, if we should do what we said,it would be 50, right?

Okay,lets move on.

Now,what is the definiton for the All characters online? Its "World.AllChar", right? Now,we need to have an count on this,simply we do this : World.AllChar.Count , alright?

Good.

Now,we gotta check if the World.AllChar.Count is the same or above as the MaxPlayer Limit, alright? This is simple to anyone who actually knows how to code,so im not even going to mention it, you could give the stupid epvp leeching community a thanks if you're happy with that,lol.

Okay,then, we did , if allchar.count is the same as the limit or above , we drop the player of the server,like this:

SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "The server is full, please try again later! ", 2000));
MyChar.MyClient.Drop();




Note, always have the MaxPlayers one more than the real one, if you want an limit of 20 people, put the MaxPlayers to 21, since it drops the character that reach the limit that is defined.

Hope it gave you some hints and ideas!

Emme


that couldnt ever do a "Max Player" thing all u have to add is in general.cs a byte "maxplayers" and at game-connection-handler after the send char info, maxplayers++; bla bla and before if(maxplayers > 50) return;
an example is:
Code:
        public void GamePacketHandler(object Sender, HybridSocket Socket)
        {
            try
            {
                if (ConnectedPlayers < 51)
                {
                    Socket Sock = Socket.WinSock;
                    IPEndPoint IPE = (IPEndPoint)Sock.RemoteEndPoint;
                    string Ip = Convert.ToString(IPE.Address);
                    int Port = IPE.Port;

                    byte[] Data = Socket.Packet;

                    if (Socket.Wrapper != null)
                    {
                        Client Cli = (Client)Socket.Wrapper;
                        Cli.GetPacket(Data);
                    }
                    else
                    {
                        Cryptographer TempCrypto = new Cryptographer();
                        TempCrypto.Decrypt(ref Data);

                        if (Data[0] == 0x1c && Data[1] == 0x00 && Data[2] == 0x1c && Data[3] == 0x04)
                        {
                            ulong Keys = Data[11];
                            Keys = (Keys << 8) | Data[10];
                            Keys = (Keys << 8) | Data[9];
                            Keys = (Keys << 8) | Data[8];
                            Keys = (Keys << 8) | Data[7];
                            Keys = (Keys << 8) | Data[6];
                            Keys = (Keys << 8) | Data[5];
                            Keys = (Keys << 8) | Data[4];

                            AuthBinder AB2 = (AuthBinder)KeyClients[Keys];
                            KeyClients.Remove(Keys);

                            Client ThisClient = AB2.Client;

                            Socket.Wrapper = ThisClient;

                            string Account = AB2.Acc;

                            ThisClient.Crypto = TempCrypto;

                            ThisClient.Crypto.SetKeys(new byte[4] { Data[11], Data[10], Data[9], Data[8] }, new byte[4] { Data[7], Data[6], Data[5], Data[4] });
                            ThisClient.Crypto.EnableAlternateKeys();

                            ThisClient.MessageId = Rand.Next(50000);
                            ThisClient.ListenSock = Socket;
                            ThisClient.GetIPE();


                            if (AB2.Auth == 1)
                            {
                                ThisClient.MyChar = new Character();
                                ThisClient.MyChar.MyClient = ThisClient;
                                ThisClient.Account = Account;
                                DataBase.GetCharInfo(ThisClient.MyChar, Account);

                                ThisClient.SendPacket(MyPackets.LanguageResponse((uint)ThisClient.MessageId));
                                ThisClient.SendPacket(MyPackets.CharacterInfo(ThisClient.MyChar));
                                ThisClient.SendPacket(MyPackets.AfterChar());
                                ConnectedPlayers++;

                                if (!World.AllChars.Contains(ThisClient.MyChar.UID))
                                {
                                    World.AllChars.Add(ThisClient.MyChar.UID, ThisClient.MyChar);
                                }
                                else
                                {
                                    ThisClient.MyChar = null;
                                    ThisClient = null;
                                    return;
                                }
                                DataBase.ChangeOnlineStatus(ThisClient.Account, 1);
                            }
                            else if (AB2.Auth == 2)
                            {
                                ThisClient.SendPacket(MyPackets.NewCharPacket(ThisClient.MessageId));
                            }
                            else
                            {
                                ThisClient.Drop();
                            }
                        }
                    }

                }
                else
                    return;
            }
            catch (Exception Exc) { WriteLine(Exc.ToString()); }
        }
and oh, u have to add "byte ConnectedPlayers = 0;" in general.cs, after
Code:
public static System.IO.StreamWriter sw = new System.IO.StreamWriter(Application.StartupPath + @"\ServerLog.txt", true);
and voila , max players added