AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   HL1 Servers (HLDS) (https://forums.alliedmods.net/forumdisplay.php?f=131)
-   -   Limit number of servers (https://forums.alliedmods.net/showthread.php?t=308770)

smiley92 07-03-2018 07:26

Limit number of servers
 
Who knows how I can do some limit to file .bat to can't be opened more servers if I write wrong, 999999 to be opened 20 for example maxim.

Code:

set /p max_servers= How many servers would you like to start?      (Ex 5)
start /min /low hlds.exe -console -game cstrike -heapsize 15000 +sys_ticrate 10000 +port %port_add% + sv_lan 0
-> this is start line

When I execut the file "start.bat", and there will ask how many servers, and if I write more than "X servers" do not allow or to open a maximum of ...

^SmileY 07-03-2018 08:52

Re: Limit number of servers
 
This do not make sense, what you exactly try to do here?

smiley92 07-03-2018 09:12

Re: Limit number of servers
 
I sayd before, I want to open more servers suddenly.

So how can I do it to that command not open more?

^SmileY 07-03-2018 09:44

Re: Limit number of servers
 
You can do a loop in bat file, but why you will put a wrong number in an .bat file?

smiley92 07-03-2018 09:59

Re: Limit number of servers
 
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).

^SmileY 07-03-2018 12:37

Re: Limit number of servers
 
https://stackoverflow.com/questions/...ch-script-loop

Here have an example how you can make a loop, but if i understand correctly your script, also you need to auto-restarter app in script

smiley92 07-03-2018 12:49

Re: Limit number of servers
 
Can you make that code for me, please?

Not necessarily auto-restart, for what?

^SmileY 07-03-2018 14:08

Re: Limit number of servers
 
1 Attachment(s)
Quote:

Originally Posted by smiley92 (Post 2600778)
Can you make that code for me, please?

Not necessarily auto-restart, for what?

TO avoid crash on HLDS and if it crash, can restart automatically.

I have made a app in C# to start my servers automatically, you can download it here.

Basically is designed to run apps (In windows) and you can adjust parameters, delay from start etc.

smiley92 07-03-2018 15:12

Re: Limit number of servers
 
I want source, can you give please?

^SmileY 07-03-2018 16:02

Re: Limit number of servers
 
Quote:

Originally Posted by smiley92 (Post 2600809)
I want source, can you give please?

i can post here when i go to home.


All times are GMT -4. The time now is 10:15.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.