Page 1 of 1

How to limit users during testing phase

Posted: Fri Oct 30, 2015 7:08 pm
by bluesolarflare
I have a server that I would like to take public soon but as it is users can freely create accounts. I would like to see if there was a method to limit the amount of users during the testing period. The only workaround I have come up with is having people register on the server forum and once they are approved they get the IP info.

Re: How to limit users during testing phase

Posted: Fri Oct 30, 2015 7:34 pm
by kjLotus
if you want to limit accounts created, you can modify the query in DSConnect that checks if an account exists, and have it also make sure there's less than however many accounts. if you're looking to limit peopled logged in, you can have it check the number of records in accounts_sessions before inserting into accounts_sessions (also in DSConnect)

Re: How to limit users during testing phase

Posted: Fri Oct 30, 2015 8:16 pm
by bluesolarflare
Hate to ask but do you know roughly around which line its located?

Re: How to limit users during testing phase

Posted: Fri Oct 30, 2015 9:12 pm
by kjLotus
not without looking myself, but you could just do a project wide search on "FROM accounts" for the first and "INTO accounts_sessions" for the other one

Re: How to limit users during testing phase

Posted: Sat Oct 31, 2015 3:26 pm
by whasf
The lobby server isn't that big, it shouldn't be hard to find

Re: How to limit users during testing phase

Posted: Tue Nov 03, 2015 3:27 pm
by bluesolarflare
whasf wrote:The lobby server isn't that big, it shouldn't be hard to find
Yeah took me a while to get the right syntax but I got it working in lobby.cpp

Code: Select all

const int8 acclimit = (Sql_Query(SqlHandle, "SELECT COUNT(*) FROM accounts_sessions"));
		
			if (acclimit < 26)
			{
				fmtQuery = "INSERT INTO accounts_sessions(accid,charid,session_key,server_addr,server_port,client_addr) VALUES(%u,%u,x'%s',%u,%u,%u)";
			}
			else
			{
			ShowError(CL_RED"recv_parse: Maximum Logins reached (25)\n" CL_RESET);
		    }

This seems to work ok. Tested with lower values and basically if the maximum logins is reached, it just times out when trying to login to the game after sitting on "Downloading Data". Since no error is given to the user that the account maximum has been reached, I'll try maximum accounts next to see what the result is if the maximum accounts are exceeded.