Raised This Month: $32 Target: $400
 8% 

Limit number of servers


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
smiley92
Senior Member
Join Date: Jun 2011
Location: Romania
Old 07-03-2018 , 07:26   Limit number of servers
Reply With Quote #1

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 ...
smiley92 is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-03-2018 , 08:52   Re: Limit number of servers
Reply With Quote #2

This do not make sense, what you exactly try to do here?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
smiley92
Senior Member
Join Date: Jun 2011
Location: Romania
Old 07-03-2018 , 09:12   Re: Limit number of servers
Reply With Quote #3

I sayd before, I want to open more servers suddenly.

So how can I do it to that command not open more?
smiley92 is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-03-2018 , 09:44   Re: Limit number of servers
Reply With Quote #4

You can do a loop in bat file, but why you will put a wrong number in an .bat file?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-03-2018 , 12:37   Re: Limit number of servers
Reply With Quote #6

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
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
smiley92
Senior Member
Join Date: Jun 2011
Location: Romania
Old 07-03-2018 , 12:49   Re: Limit number of servers
Reply With Quote #7

Can you make that code for me, please?

Not necessarily auto-restart, for what?

Last edited by smiley92; 07-03-2018 at 12:49.
smiley92 is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-03-2018 , 14:08   Re: Limit number of servers
Reply With Quote #8

Quote:
Originally Posted by smiley92 View Post
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.
Attached Files
File Type: zip StartUp.zip (130.6 KB, 48 views)
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
smiley92
Senior Member
Join Date: Jun 2011
Location: Romania
Old 07-03-2018 , 15:12   Re: Limit number of servers
Reply With Quote #9

I want source, can you give please?
smiley92 is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-03-2018 , 16:02   Re: Limit number of servers
Reply With Quote #10

Quote:
Originally Posted by smiley92 View Post
I want source, can you give please?
i can post here when i go to home.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:49.


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