Englisch limit sv_maxplayers

3 Antworten
Gehe zu Seite
Zum Anfang Vorherige 1 Nächste Zum Anfang
07.09.21 09:58:41
Hoch
Marcell
Super User
Offline Off
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.
07.09.21 10:32:00
Hoch
Mami Tomoe
User
Offline Off
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:

Code:
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.
fish
07.09.21 10:40:33
Hoch
Marcell
Super User
Offline Off
@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...
07.09.21 11:31:11
Hoch
MikuAuahDark
User
Offline Off
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:

Code:
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.
file cs2d LuaJIT for Dedicated Server (13) JIT POWER! | Know your Lua errors! | Part of LÖVE development team since 11.3
Zum Anfang Vorherige 1 Nächste Zum Anfang