Register for your free account! | Forgot your password?

You last visited: Today at 12:06

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[RELEASE]PlayerLimit

Discussion on [RELEASE]PlayerLimit within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,765
Received Thanks: 382
[RELEASE]PlayerLimit

(For tanels source)

This is just a simple release for playerlimit.
can be done in many way, but this one is good.
if u are about to ask why i dont use world.h_chars.count,
then is because is not working. it will simply make server full when is online players are not eve 1% close to it XD
Im not going to release more anyway.
here is some of my trash.

anyways here it is.
in program.cs put:
Code:
public static int OnlinePlayers = 0;
Now find in program.cs:
Code:
Database.LoadLottoItems();
under it put:
Code:
OnlinePlayers = 0;
Now open GameWorker.cs and search for:
Code:
                        if (PacketID == 1052)
                        {
                            try
                            {
                                ulong CryptoKey = BitConverter.ToUInt64(Data, 4);

                                AuthWorker.AuthInfo Info = (AuthWorker.AuthInfo)AuthWorker.KeyedClients[CryptoKey];
                                GC.AuthInfo = Info;
                                GC.MessageID = (uint)Rnd.Next(50000);
                                GC.Soc = StO.Sock;
right under this put:
Code:
                                if (Program.OnlinePlayers >= 100)//Change to the limit u want
                                {
                                    GC.AddSend(Packets.SystemMessage(GC.MessageID, "Server is Full! Online Players: " + Program.OnlinePlayers + "/100."));
                                }
Now in Teleport.cs put this under the loginmessage:
Code:
Program.OnlinePlayers += 1;
Now find (in GameClient.cs)
Code:
        public void LogOff(bool Remove)
        {
            try
            {
under that put:
Code:
Program.OnlinePlayers -= 1;
This should work
Any problems let me know

if im right the OnlinePlayers thing will always stay alittle above then World.H_Chars.Count.
Fish* is offline  
Old 07/10/2010, 17:04   #2


 
KraHen's Avatar
 
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 794
Ain`t there a container or something for the gameclients? Why not check those?
KraHen is offline  
Old 07/10/2010, 22:29   #3
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,765
Received Thanks: 382
just released it, cuz was some trash i run about in a folder lol
Fish* is offline  
Old 07/10/2010, 22:48   #4
 
elite*gold: 0
Join Date: May 2010
Posts: 298
Received Thanks: 57
Yeah its like
Code:
foreach(client.client Clients in Kernel.gamepool.count)
{
if Client > PlayerLimit
{
whatever
}
}
else
OK
}
Too simple,

It's not that grillmad coudn't do it, It was that he never thought of it
MonstersAbroad is offline  
Old 07/10/2010, 22:49   #5
 
~Master's Avatar
 
elite*gold: 0
Join Date: Jun 2010
Posts: 118
Received Thanks: 23
Quote:
LOL, banned ftw.
I dont release more, but anything you need, whisper me and I will try my best
hmm
~Master is offline  
Old 07/10/2010, 22:51   #6


 
KraHen's Avatar
 
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 794
Quote:
Originally Posted by MonstersAbroad View Post
Yeah its like
Code:
foreach(client.client Clients in Kernel.gamepool.count)
{
if Client > PlayerLimit
{
whatever
}
}
else
OK
}
Too simple,

It's not that grillmad coudn't do it, It was that he never thought of it
Why not just have a counter variable in the server socket code, and check it whenever someone tries to connect...
KraHen is offline  
Old 07/10/2010, 22:57   #7
 
elite*gold: 0
Join Date: May 2010
Posts: 298
Received Thanks: 57
Like you said, Why not
MonstersAbroad is offline  
Old 07/11/2010, 01:03   #8
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,765
Received Thanks: 382
Quote:
Originally Posted by ~Master View Post
hmm
if u read i said this is last.
cuz i just saw some trash at my pc and thought i would smack it up here
Fish* is offline  
Old 07/11/2010, 01:05   #9


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
What happens if the client crashes? It wont be an eligant logoff so i cant imagine this is going to work correctly in that case, so eventually people wont be able to login because the server will think its full.
Korvacs is offline  
Old 07/11/2010, 13:30   #10
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,765
Received Thanks: 382
yee korvacs xD
I tested it and always count like 2-3backwards then the real count.
and then it starts go negative XD
Fish* is offline  
Reply


Similar Threads Similar Threads
Wie setzt man ein Playerlimit?
05/02/2010 - Metin2 Private Server - 0 Replies
Hallo, Ich möchte gerne wissen wie man ein Playerlimit auf einem Server setzt würde mich über Antworten freuen. MfG MasterS4Dead12



All times are GMT +1. The time now is 12:07.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.