How to limit users during testing phase

Post Reply
bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

How to limit users during testing phase

Post by bluesolarflare » Fri Oct 30, 2015 7:08 pm

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.

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: How to limit users during testing phase

Post by kjLotus » Fri Oct 30, 2015 7:34 pm

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)

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: How to limit users during testing phase

Post by bluesolarflare » Fri Oct 30, 2015 8:16 pm

Hate to ask but do you know roughly around which line its located?

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: How to limit users during testing phase

Post by kjLotus » Fri Oct 30, 2015 9:12 pm

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

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: How to limit users during testing phase

Post by whasf » Sat Oct 31, 2015 3:26 pm

The lobby server isn't that big, it shouldn't be hard to find
-- Whasf

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: How to limit users during testing phase

Post by bluesolarflare » Tue Nov 03, 2015 3:27 pm

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.

Post Reply