View Single Post
smiley92
Senior Member
Join Date: Jun 2011
Location: Romania
Old 07-03-2018 , 09:59   Re: Limit number of servers
Reply With Quote #5

I don't know very well where to do a loop, but didn't work properly.
Not in a .bat file to put wrong number, when I execute .bat file is problem and ask how many servers to start.
If I write there 99999 is opened 99999 hlds servers.

Code:
@echo off

set /p max_servers= How many servers would you like to start?      (Ex 10):
set /p starting_port= PORT ?         (Ex 29000):


set /a start_delay= 2



title Starting %max_servers% servers...
echo Starting %max_servers% servers with %start_delay% delay, first port %starting_port%...
set /a port_add=%starting_port%
set /a port_end=%starting_port% + %max_servers%
set /a sv_add = 1


:loop
start /min /low  hlds.exe -console -game cstrike -heapsize 15000 +sys_ticrate 10000 +port %port_add% + sv_lan 0 +exec server%sv_add%.cfg 
set /a port_add+=1 
set /a sv_add +=1
if %port_add%==%port_end% goto end
 
ping 1.1.1.1 -n %start_delay% -l 1 -w 10000 >NUL
goto :loop
 


:end
echo All servers started.
pause
exit
There if I write to start 11 servers will be start 11.
I want to do some limit, but to ask me how many servers to start.
For example, if I write to that question 999 servers, to start maximum limited (for example 10 servers).

Last edited by smiley92; 07-03-2018 at 10:08.
smiley92 is offline