Forum

> > CS2D > General > limit sv_maxplayers
ForenübersichtCS2D-ÜbersichtGeneral-ÜbersichtEinloggen, um zu antworten

Englisch limit sv_maxplayers

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt limit sv_maxplayers

Marcell
Super User Off Offline

Zitieren
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.

alt Re: limit sv_maxplayers

Mami Tomoe
User Off Offline

Zitieren
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.

alt Re: limit sv_maxplayers

Marcell
Super User Off Offline

Zitieren
@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...

alt Re: limit sv_maxplayers

MikuAuahDark
User Off Offline

Zitieren
user Mami Tomoe hat geschrieben
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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenGeneral-ÜbersichtCS2D-ÜbersichtForenübersicht