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:
#2
Hooligans?
LSS?
Fork off.
Thanks given by:
#3
Yes, feel free to fork it. It's open source!
/me trollfaces
Thanks given by:
#4
Glad you got the pun, for a while I started to get scared it would be taken offensively. XD

"Hooligans" in this game more properly refers to servers that only support T/OSOK. /:D
Thanks given by:
#5
MasterKaen, this is fine. Since it's currently possible to block LSS votes just by listing the maps individually (even though it could take a lot of lines), modding the server to make it easier isn't a problem. You'll be pleased to know that this function has already been implemented in the SVN code.
Thanks given by:
#6
Lol jams that would take a long time along with unofficial maps.
Thanks given by:
#7
@ W@rr!0r

Yes that can take a long time if you add every crap map out there to your server.
And you still can block others from uploading maps without having admin.
Thanks given by:
#8
This could very well be helpful in the future, since it seems like any given time that I have gone to play, (T)OSOK is the greater majority of what is being played. This has gotten me considering starting my own server for TDM. Everyone has their own tastes in game styles, so this surely helps server admins keeping things running they way they like. Good job.
Thanks given by:
#9
(17 Dec 11, 04:46AM)V-Man Wrote: Hooligans?
LSS?
Fork off.

I lold
Thanks given by: