Forum

> > CS2D > General > limit sv_maxplayers
Forums overviewCS2D overviewGeneral overviewLog in to reply

English limit sv_maxplayers

3 replies
To the start Previous 1 Next To the start

old limit sv_maxplayers

Marcell
Super User Off Offline

Quote
Hello,

I was wondering if anyone, especially CS2D's developers would have any clue on how to actually limit sv_maxplayers.

Since many cases below, it just have no control to do so.

• limiting write permissions to server.cfg no help, as rcon users can easily bypass over console, even for that just session.
• we also discussed a few options with @user MikuAuahDark: and BOT_AI over Discord, but we couldn't find a proper solution to prevent.

Could perhaps DC or Simonas simply limit certain options over console parameters, when server start?

It would be a huge help to limit certain things. Right now there is always a little hack to do so.

old Re: limit sv_maxplayers

Mami Tomoe
User Off Offline

Quote
I sense you love over complicating things simply because you do not know how to make a proper framework.

Here's a chunk of what a framework would do:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
local cs2d_parse	= parse
local stop_on		= {
	'sv_maxplayers'	
}

function parse(params, sas)
	for i = 1, #stop_on do
		local so = stop_on[i]

		if params:find(so) then

			return false, so .. ' is disabled'
		end
	end

	return true, cs2d_parse(params, sas)
end

This can't be messed with, if it gets
dofile
'd above every other script in the server.lua file.
That is because you localised the real cs2d lua cmd parse function, so only that file can use it.

Of course the check is very lazy, so doing stuff like:
sv_maxplayers 4;kick 4

Will not work at all, even though the second action should've passed.
You can just split the string and do the check for every command parsed, I'm not going to do that though because it seems redudent (as nobody uses it).

This allows you to ban more than one command too.

old Re: limit sv_maxplayers

Marcell
Super User Off Offline

Quote
@user Mami Tomoe: Or I just don't want to bother with making a framework, because I need time for other things. You know, I also do other stuffs beside of sitting in front of the computer.

There is a very easy solution, which just figured out now and I had no idea adding parameters to cs2d binary simply forces those settings even with rcon.

So as simple is that.

No need to over complicate as you said...

old Re: limit sv_maxplayers

MikuAuahDark
User Off Offline

Quote
user Mami Tomoe has written
I sense you love over complicating things simply because you do not know how to make a proper framework.

Here's a chunk of what a framework would do:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
local cs2d_parse	= parse
local stop_on		= {
	'sv_maxplayers'	
}

function parse(params, sas)
	for i = 1, #stop_on do
		local so = stop_on[i]

		if params:find(so) then

			return false, so .. ' is disabled'
		end
	end

	return true, cs2d_parse(params, sas)
end

This can't be messed with, if it gets
dofile
'd above every other script in the server.lua file.
That is because you localised the real cs2d lua cmd parse function, so only that file can use it.

Of course the check is very lazy, so doing stuff like:
sv_maxplayers 4;kick 4

Will not work at all, even though the second action should've passed.
You can just split the string and do the check for every command parsed, I'm not going to do that though because it seems redudent (as nobody uses it).

This allows you to ban more than one command too.


Not quite. It's possible to use the debug library to retrieve the original cs2d lua cmd parse function. He also can't disable the debug library because it can break (existing) scripts that depends on it.
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview