Restricting game modes
#1
Here's a super short patch to add mode restrictions to your server. I use this for my T/OSOK server to keep hooligans from voting up LSS or something.

Simply find (in source/src/serveractions.h) the part that says:

loopv(scl.adminonlymaps)
{
   const char *s = scl.adminonlymaps[i], *h = strchr(s, '#'), *m = behindpath(map);
   size_t sl = strlen(s);
   if(h && h != s)
   {
      sl = h - s;
      if(mode != atoi(h + 1)) continue;
   }
   if(sl == strlen(m) && !strncmp(m, scl.adminonlymaps[i], sl)) role = CR_ADMIN;
}

And add these three lines:

if(h && h == s) {
   if(mode == atoi(h + 1)) role = CR_ADMIN;
}

To make:

loopv(scl.adminonlymaps)
{
   const char *s = scl.adminonlymaps[i], *h = strchr(s, '#'), *m = behindpath(map);
   size_t sl = strlen(s);
   if(h && h == s) {
      if(mode == atoi(h + 1)) role = CR_ADMIN;
   }
   if(h && h != s)
   {
      sl = h - s;
      if(mode != atoi(h + 1)) continue;
   }
   if(sl == strlen(m) && !strncmp(m, scl.adminonlymaps[i], sl)) role = CR_ADMIN;
}

This will allow you to add something like
-A#5
to your servercmdline.txt file, which would disallow CTF games on any map. Of course, an admin can still set the mode to CTF.
Thanks given by:


Messages In This Thread
Restricting game modes - by MasterKaen - 17 Dec 11, 01:42AM
RE: Restricting game modes - by V-Man - 17 Dec 11, 04:46AM
RE: Restricting game modes - by Murmer - 07 Jan 12, 02:48AM
RE: Restricting game modes - by MasterKaen - 17 Dec 11, 05:51AM
RE: Restricting game modes - by V-Man - 17 Dec 11, 07:55AM
RE: Restricting game modes - by jamz - 17 Dec 11, 10:06AM
RE: Restricting game modes - by W@rr!0r - 03 Jan 12, 06:23PM
RE: Restricting game modes - by OpenSource - 03 Jan 12, 07:04PM
RE: Restricting game modes - by DarkCollapse - 07 Jan 12, 02:39AM