This commit is contained in:
kai
2026-10-25 21:21:47 +00:00
parent 512f3270e1
commit 72f0aef305
20 changed files with 251 additions and 256 deletions
-27
View File
@@ -1,27 +0,0 @@
// Put in this file the words you consider to be inappropriate in your server
// The system automatically pass all uppercase letters to lowercase
// You can put pairs of words which should not come together in the same phrase
// so "banana caramelada" will block "eu tenho uma banana, que eh muito caramelada"
// but will not block "minha banana eh grande"
// Below it is presented some default examples
fuck
bitch
8==
==8
your mother
suck dick
big cock
// from TyD nickblacklist
asshole // "ass" is not blacklisted
horny
hurensohn // "Son of a bitch" in german.
masturb // See "wank".
necrop // Ban names that mention some form of necrophilia.
pedop
penis
pussy
filho puta // "whore" or "slut" in portugese.
redtube
porntube
youporn
+58 -49
View File
@@ -78,6 +78,7 @@ menuinitselection 13
//// In-Game admin //// (In-game menu that opens if when you press escape if you're admin state and connected to a game.) //// In-Game admin //// (In-game menu that opens if when you press escape if you're admin state and connected to a game.)
newmenu [In-game admin] newmenu [In-game admin]
menuadminonly 1
menuinit [ menuinit [
resetcurmenu resetcurmenu
menuitem "Set mode/map\i\3" [ showmenu Gamemode ] menuitem "Set mode/map\i\3" [ showmenu Gamemode ]
@@ -158,6 +159,7 @@ menuitem [Turn auto-team off] [ autoteam 0 ]
//// In-Game admin > Mastermode //// //// In-Game admin > Mastermode ////
newmenu Mastermode newmenu Mastermode
menuadminonly 2
menuitem [Unlock the server (open)] [ mastermode 0 ] menuitem [Unlock the server (open)] [ mastermode 0 ]
menuitem [Lock the server (private)] [ mastermode 1 ] menuitem [Lock the server (private)] [ mastermode 1 ]
menuitem [Lock the server (match mode)] [ mastermode 2; showmenu [Match Settings] ] menuitem [Lock the server (match mode)] [ mastermode 2; showmenu [Match Settings] ]
@@ -165,17 +167,18 @@ menuitem [Lock the server (match mode)] [ mastermode 2; showmenu [Match Settings
//// In-Game admin > Match Settings //// //// In-Game admin > Match Settings ////
newmenu [Match Settings] newmenu [Match Settings]
menuadminonly 2
menuinit [ ] menuinit [ ]
menuitemslider "Recoil Multiplier: " 50 500 "$matchrecoilmul" 10 [ matchrecoilmul $arg1 ] menuitemslider "Recoil Multiplier: " 50 500 "$matchrecoilmul" 10 [ matchset matchrecoilmul $arg1 ]
menuitemslider "Spread Multiplier: " 50 500 "$matchspreadmul" 10 [ matchspreadmul $arg1 ] menuitemslider "Spread Multiplier: " 50 500 "$matchspreadmul" 10 [ matchset matchspreadmul $arg1 ]
menuitemslider "Speed Multiplier: " 50 500 "$matchspeedmul" 10 [ matchspeedmul $arg1 ] menuitemslider "Speed Multiplier: " 50 500 "$matchspeedmul" 10 [ matchset matchspeedmul $arg1 ]
menuitemslider "Gravity Multiplier: " 50 500 "$matchgravity" 10 [ matchgravity $arg1 ] menuitemslider "Gravity Multiplier: " 50 500 "$matchgravity" 10 [ matchset matchgravity $arg1 ]
menuitemslider "Friction Multiplier: " 10 500 "$matchfriction" 10 [ matchfriction $arg1 ] menuitemslider "Friction Multiplier: " 10 500 "$matchfriction" 10 [ matchset matchfriction $arg1 ]
menuitem "" -1 menuitem "" -1
menuitemcheckbox "Enable Assists: " "$matchassist" [ matchassist $arg1 ] menuitemcheckbox "Enable Assists: " "$matchassist" [ matchset matchassist $arg1 ]
menuitemcheckbox "Explosive Deaths: " "$matchdeathexplosion" [ matchdeathexplosion $arg1 ] menuitemcheckbox "Explosive Deaths: " "$matchdeathexplosion" [ matchset matchdeathexplosion $arg1 ]
menuitemslider " Blast Radius %: " 10 300 "$matchdeathradius" 10 [ matchdeathradius $arg1 ] menuitemslider " Blast Radius %: " 10 300 "$matchdeathradius" 10 [ matchset matchdeathradius $arg1 ]
menuitemslider " Blast Power %: " 10 500 "$matchdeathpower" 10 [ matchdeathpower $arg1 ] menuitemslider " Blast Power %: " 10 500 "$matchdeathpower" 10 [ matchset matchdeathpower $arg1 ]
menuitem "" -1 menuitem "" -1
menuitem "Friendly Fire\i\3" [ showmenu [Match Friendly Fire] ] menuitem "Friendly Fire\i\3" [ showmenu [Match Friendly Fire] ]
menuitem "" -1 menuitem "" -1
@@ -183,22 +186,24 @@ menuitem "Spawn Weapons\i\3" [ showmenu [Match Spawn Weapons] ]
menuitem "" -1 menuitem "" -1
menuitem "\f2Start Bot Match" [ startbotmap ] menuitem "\f2Start Bot Match" [ startbotmap ]
menuitem "" -1 menuitem "" -1
menuitem "Reset to defaults (100%)" [ matchrecoilmul 100; matchspreadmul 100; matchspeedmul 100; matchgravity 100; matchfriction 100; matchdeathradius 100; matchdeathpower 100; matchassist 1; matchfriendlyfire 1; matchdeathexplosion 0; matchspawnprimary -1; matchspawnsecondary -1; matchspawntertiary -1; matchspawnquaternary -1; showmenu [Match Settings] ] menuitem "Reset to defaults" [ matchsetreset; showmenu [Match Settings] ]
menuitem "Back" [ showmenu Mastermode ] menuitem "Back" [ showmenu Mastermode ]
//// In-Game admin > Match Settings > Friendly Fire //// //// In-Game admin > Match Settings > Friendly Fire ////
newmenu [Match Friendly Fire] newmenu [Match Friendly Fire]
menuadminonly 2
menuinit [ ] menuinit [ ]
menuitem "Off (no damage)" [ matchfriendlyfire 0; showmenu [Match Settings] ] menuitem "Off (no damage)" [ matchset matchfriendlyfire 0; showmenu [Match Settings] ]
menuitem "On (normal)" [ matchfriendlyfire 1; showmenu [Match Settings] ] menuitem "On (normal)" [ matchset matchfriendlyfire 1; showmenu [Match Settings] ]
menuitem "Off + no shoot teammates" [ matchfriendlyfire 2; showmenu [Match Settings] ] menuitem "Off + no shoot teammates" [ matchset matchfriendlyfire 2; showmenu [Match Settings] ]
menuitem "" -1 menuitem "" -1
menuitem "Back" [ showmenu [Match Settings] ] menuitem "Back" [ showmenu [Match Settings] ]
//// In-Game admin > Match Settings > Spawn Weapons //// //// In-Game admin > Match Settings > Spawn Weapons ////
newmenu [Match Spawn Weapons] newmenu [Match Spawn Weapons]
menuadminonly 2
menuinit [ ] menuinit [ ]
menutitle "Spawn weapons (primary = what you hold, others = extra guns)" menutitle "Spawn weapons (primary = what you hold, others = extra guns)"
menuitem "Primary Weapon\i\3" [ showmenu [Match Spawn Primary] ] menuitem "Primary Weapon\i\3" [ showmenu [Match Spawn Primary] ]
@@ -211,64 +216,68 @@ menuitem "Back" [ showmenu [Match Settings] ]
//// In-Game admin > Match Settings > Spawn Weapons > Primary //// //// In-Game admin > Match Settings > Spawn Weapons > Primary ////
newmenu [Match Spawn Primary] newmenu [Match Spawn Primary]
menuadminonly 2
menuinit [ ] menuinit [ ]
menuitem "Default (your own choice)" [ matchspawnprimary -1; showmenu [Match Spawn Weapons] ] menuitem "Default (your own choice)" [ matchset matchspawnprimary -1; showmenu [Match Spawn Weapons] ]
menuitem "Knife" [ matchspawnprimary 0; showmenu [Match Spawn Weapons] ] menuitem "Knife" [ matchset matchspawnprimary 0; showmenu [Match Spawn Weapons] ]
menuitem "Pistol" [ matchspawnprimary 1; showmenu [Match Spawn Weapons] ] menuitem "Pistol" [ matchset matchspawnprimary 1; showmenu [Match Spawn Weapons] ]
menuitem "Carbine" [ matchspawnprimary 2; showmenu [Match Spawn Weapons] ] menuitem "Carbine" [ matchset matchspawnprimary 2; showmenu [Match Spawn Weapons] ]
menuitem "Shotgun" [ matchspawnprimary 3; showmenu [Match Spawn Weapons] ] menuitem "Shotgun" [ matchset matchspawnprimary 3; showmenu [Match Spawn Weapons] ]
menuitem "Subgun" [ matchspawnprimary 4; showmenu [Match Spawn Weapons] ] menuitem "Subgun" [ matchset matchspawnprimary 4; showmenu [Match Spawn Weapons] ]
menuitem "Sniper" [ matchspawnprimary 5; showmenu [Match Spawn Weapons] ] menuitem "Sniper" [ matchset matchspawnprimary 5; showmenu [Match Spawn Weapons] ]
menuitem "Assault" [ matchspawnprimary 6; showmenu [Match Spawn Weapons] ] menuitem "Assault" [ matchset matchspawnprimary 6; showmenu [Match Spawn Weapons] ]
menuitem "Grenade" [ matchspawnprimary 7; showmenu [Match Spawn Weapons] ] menuitem "Grenade" [ matchset matchspawnprimary 7; showmenu [Match Spawn Weapons] ]
menuitem "" -1 menuitem "" -1
menuitem "Back" [ showmenu [Match Spawn Weapons] ] menuitem "Back" [ showmenu [Match Spawn Weapons] ]
//// In-Game admin > Match Settings > Spawn Weapons > Secondary //// //// In-Game admin > Match Settings > Spawn Weapons > Secondary ////
newmenu [Match Spawn Secondary] newmenu [Match Spawn Secondary]
menuadminonly 2
menuinit [ ] menuinit [ ]
menuitem "None" [ matchspawnsecondary -1; showmenu [Match Spawn Weapons] ] menuitem "None" [ matchset matchspawnsecondary -1; showmenu [Match Spawn Weapons] ]
menuitem "Knife" [ matchspawnsecondary 0; showmenu [Match Spawn Weapons] ] menuitem "Knife" [ matchset matchspawnsecondary 0; showmenu [Match Spawn Weapons] ]
menuitem "Pistol" [ matchspawnsecondary 1; showmenu [Match Spawn Weapons] ] menuitem "Pistol" [ matchset matchspawnsecondary 1; showmenu [Match Spawn Weapons] ]
menuitem "Carbine" [ matchspawnsecondary 2; showmenu [Match Spawn Weapons] ] menuitem "Carbine" [ matchset matchspawnsecondary 2; showmenu [Match Spawn Weapons] ]
menuitem "Shotgun" [ matchspawnsecondary 3; showmenu [Match Spawn Weapons] ] menuitem "Shotgun" [ matchset matchspawnsecondary 3; showmenu [Match Spawn Weapons] ]
menuitem "Subgun" [ matchspawnsecondary 4; showmenu [Match Spawn Weapons] ] menuitem "Subgun" [ matchset matchspawnsecondary 4; showmenu [Match Spawn Weapons] ]
menuitem "Sniper" [ matchspawnsecondary 5; showmenu [Match Spawn Weapons] ] menuitem "Sniper" [ matchset matchspawnsecondary 5; showmenu [Match Spawn Weapons] ]
menuitem "Assault" [ matchspawnsecondary 6; showmenu [Match Spawn Weapons] ] menuitem "Assault" [ matchset matchspawnsecondary 6; showmenu [Match Spawn Weapons] ]
menuitem "Grenade" [ matchspawnsecondary 7; showmenu [Match Spawn Weapons] ] menuitem "Grenade" [ matchset matchspawnsecondary 7; showmenu [Match Spawn Weapons] ]
menuitem "" -1 menuitem "" -1
menuitem "Back" [ showmenu [Match Spawn Weapons] ] menuitem "Back" [ showmenu [Match Spawn Weapons] ]
//// In-Game admin > Match Settings > Spawn Weapons > Tertiary //// //// In-Game admin > Match Settings > Spawn Weapons > Tertiary ////
newmenu [Match Spawn Tertiary] newmenu [Match Spawn Tertiary]
menuadminonly 2
menuinit [ ] menuinit [ ]
menuitem "None" [ matchspawntertiary -1; showmenu [Match Spawn Weapons] ] menuitem "None" [ matchset matchspawntertiary -1; showmenu [Match Spawn Weapons] ]
menuitem "Knife" [ matchspawntertiary 0; showmenu [Match Spawn Weapons] ] menuitem "Knife" [ matchset matchspawntertiary 0; showmenu [Match Spawn Weapons] ]
menuitem "Pistol" [ matchspawntertiary 1; showmenu [Match Spawn Weapons] ] menuitem "Pistol" [ matchset matchspawntertiary 1; showmenu [Match Spawn Weapons] ]
menuitem "Carbine" [ matchspawntertiary 2; showmenu [Match Spawn Weapons] ] menuitem "Carbine" [ matchset matchspawntertiary 2; showmenu [Match Spawn Weapons] ]
menuitem "Shotgun" [ matchspawntertiary 3; showmenu [Match Spawn Weapons] ] menuitem "Shotgun" [ matchset matchspawntertiary 3; showmenu [Match Spawn Weapons] ]
menuitem "Subgun" [ matchspawntertiary 4; showmenu [Match Spawn Weapons] ] menuitem "Subgun" [ matchset matchspawntertiary 4; showmenu [Match Spawn Weapons] ]
menuitem "Sniper" [ matchspawntertiary 5; showmenu [Match Spawn Weapons] ] menuitem "Sniper" [ matchset matchspawntertiary 5; showmenu [Match Spawn Weapons] ]
menuitem "Assault" [ matchspawntertiary 6; showmenu [Match Spawn Weapons] ] menuitem "Assault" [ matchset matchspawntertiary 6; showmenu [Match Spawn Weapons] ]
menuitem "Grenade" [ matchspawntertiary 7; showmenu [Match Spawn Weapons] ] menuitem "Grenade" [ matchset matchspawntertiary 7; showmenu [Match Spawn Weapons] ]
menuitem "" -1 menuitem "" -1
menuitem "Back" [ showmenu [Match Spawn Weapons] ] menuitem "Back" [ showmenu [Match Spawn Weapons] ]
//// In-Game admin > Match Settings > Spawn Weapons > Quaternary //// //// In-Game admin > Match Settings > Spawn Weapons > Quaternary ////
newmenu [Match Spawn Quaternary] newmenu [Match Spawn Quaternary]
menuadminonly 2
menuinit [ ] menuinit [ ]
menuitem "None" [ matchspawnquaternary -1; showmenu [Match Spawn Weapons] ] menuitem "None" [ matchset matchspawnquaternary -1; showmenu [Match Spawn Weapons] ]
menuitem "Knife" [ matchspawnquaternary 0; showmenu [Match Spawn Weapons] ] menuitem "Knife" [ matchset matchspawnquaternary 0; showmenu [Match Spawn Weapons] ]
menuitem "Pistol" [ matchspawnquaternary 1; showmenu [Match Spawn Weapons] ] menuitem "Pistol" [ matchset matchspawnquaternary 1; showmenu [Match Spawn Weapons] ]
menuitem "Carbine" [ matchspawnquaternary 2; showmenu [Match Spawn Weapons] ] menuitem "Carbine" [ matchset matchspawnquaternary 2; showmenu [Match Spawn Weapons] ]
menuitem "Shotgun" [ matchspawnquaternary 3; showmenu [Match Spawn Weapons] ] menuitem "Shotgun" [ matchset matchspawnquaternary 3; showmenu [Match Spawn Weapons] ]
menuitem "Subgun" [ matchspawnquaternary 4; showmenu [Match Spawn Weapons] ] menuitem "Subgun" [ matchset matchspawnquaternary 4; showmenu [Match Spawn Weapons] ]
menuitem "Sniper" [ matchspawnquaternary 5; showmenu [Match Spawn Weapons] ] menuitem "Sniper" [ matchset matchspawnquaternary 5; showmenu [Match Spawn Weapons] ]
menuitem "Assault" [ matchspawnquaternary 6; showmenu [Match Spawn Weapons] ] menuitem "Assault" [ matchset matchspawnquaternary 6; showmenu [Match Spawn Weapons] ]
menuitem "Grenade" [ matchspawnquaternary 7; showmenu [Match Spawn Weapons] ] menuitem "Grenade" [ matchset matchspawnquaternary 7; showmenu [Match Spawn Weapons] ]
menuitem "" -1 menuitem "" -1
menuitem "Back" [ showmenu [Match Spawn Weapons] ] menuitem "Back" [ showmenu [Match Spawn Weapons] ]
+1 -2
View File
@@ -15,7 +15,7 @@
// example MOTD: // example MOTD:
-o \f3server using example cmdline file (config/servercmdline.txt)\n\f2gassy server 🥶 -o \f3server using example cmdline file (config/servercmdline.txt)\n\f2gassy server 🥶
-f 27015
// commonly used commandline switches: // commonly used commandline switches:
@@ -51,7 +51,6 @@
// -B // server IP blacklist file, default config/serverblacklist.cfg // -B // server IP blacklist file, default config/serverblacklist.cfg
// -G // server geoip file, default config/geoip.cfg // -G // server geoip file, default config/geoip.cfg
// -K // server nickname blacklist file, default config/nicknameblacklist.cfg // -K // server nickname blacklist file, default config/nicknameblacklist.cfg
// -g // server forbidden words file, default config/forbidden.cfg
// -P // permission string (read docs/commandline.html) // -P // permission string (read docs/commandline.html)
// k vote to kick players // k vote to kick players
// b vote to ban players (and remove bans) // b vote to ban players (and remove bans)
+1
View File
@@ -6,3 +6,4 @@
// password [denyadmin] // password [denyadmin]
// optional: if denyadmin is set to '1', the password can only be used to connect to the server in case of ban, not to claim admin // optional: if denyadmin is set to '1', the password can only be used to connect to the server in case of ban, not to claim admin
awesomesauce
-1
View File
@@ -185,7 +185,6 @@
<Unit filename="../../config/font_default.cfg" /> <Unit filename="../../config/font_default.cfg" />
<Unit filename="../../config/font_monospace.cfg" /> <Unit filename="../../config/font_monospace.cfg" />
<Unit filename="../../config/font_serif.cfg" /> <Unit filename="../../config/font_serif.cfg" />
<Unit filename="../../config/forbidden.cfg" />
<Unit filename="../../config/keymap.cfg" /> <Unit filename="../../config/keymap.cfg" />
<Unit filename="../../config/maprot.cfg" /> <Unit filename="../../config/maprot.cfg" />
<Unit filename="../../config/menus.cfg" /> <Unit filename="../../config/menus.cfg" />
+1
View File
@@ -184,6 +184,7 @@ void disconnect(int onlyclean, int async)
kickallbots(); kickallbots();
loopv(players) zapplayer(players[i]); loopv(players) zapplayer(players[i]);
clearvote(); clearvote();
matchsettings_reset();
audiomgr.clearworldsounds(false); audiomgr.clearworldsounds(false);
localdisconnect(); localdisconnect();
} }
+2
View File
@@ -59,6 +59,8 @@ bool duplicatename(playerent *d, char *name = NULL)
char *colorname(playerent *d, char *name, const char *prefix) char *colorname(playerent *d, char *name, const char *prefix)
{ {
if(!name) name = d->name; if(!name) name = d->name;
static char unnamed[] = "unnamed";
if(!name[0]) name = unnamed; // still joining, real name not received yet: never display a bare "(cn)"
bool isdname = duplicatename(d, name); bool isdname = duplicatename(d, name);
if(name[0] && !isdname && !getigraph(name + 1)) return name; if(name[0] && !isdname && !getigraph(name + 1)) return name;
static string cname[4]; static string cname[4];
+11
View File
@@ -749,6 +749,17 @@ void parsemessages(int cn, playerent *d, ucharbuf &p, bool demo = false)
break; break;
} }
case SV_MATCHSETTINGS: // the server's match settings (sent when they change, and when we join)
{
int n = getint(p);
loopi(n)
{
int v = getint(p);
if(i < NUMMATCHSETTINGS) matchsetting_apply(i, v);
}
break;
}
case SV_DEATHBLAST: // "explosive deaths": the damage comes as normal SV_DAMAGE messages, this is just the visual/sound case SV_DEATHBLAST: // "explosive deaths": the damage comes as normal SV_DAMAGE messages, this is just the visual/sound
{ {
int cn = getint(p); int cn = getint(p);
+10
View File
@@ -87,6 +87,16 @@ extern int matchdeathradius, matchdeathpower;
#define DEATHBLASTRAD (EXPDAMRAD*matchdeathradius/100.0f) #define DEATHBLASTRAD (EXPDAMRAD*matchdeathradius/100.0f)
#define DEATHBLASTDMG (guns[GUN_GRENADE].damage*3/4*matchdeathpower/100) #define DEATHBLASTDMG (guns[GUN_GRENADE].damage*3/4*matchdeathpower/100)
// Match settings. Online they belong to the server: only an admin can change them (SV_MATCHSET), the server keeps
// the values, sends them to every client when they change and to everybody who joins (SV_MATCHSETTINGS).
// Offline/bot games have no server, so there you simply set them yourself. Defined in server.cpp (which is part of the client too).
struct matchsettingdef { const char *name; int *var; int min, def, max; };
#define NUMMATCHSETTINGS 14
extern matchsettingdef matchsettings[NUMMATCHSETTINGS];
extern int matchsynced[NUMMATCHSETTINGS]; // client side: the values the server last announced
extern void matchsettings_reset(); // everything back to the defaults
extern bool matchsetting_apply(int idx, int val); // clamps and stores, true if the value changed
struct itemstat { int add, start, max, sound; }; struct itemstat { int add, start, max, sound; };
extern itemstat ammostats[NUMGUNS]; extern itemstat ammostats[NUMGUNS];
extern itemstat powerupstats[I_ARMOUR-I_HEALTH+1]; extern itemstat powerupstats[I_ARMOUR-I_HEALTH+1];
+1
View File
@@ -1407,6 +1407,7 @@ int main(int argc, char **argv)
banmenu = addmenu("ban player", NULL, true, refreshsopmenu); banmenu = addmenu("ban player", NULL, true, refreshsopmenu);
forceteammenu = addmenu("force team", NULL, true, refreshsopmenu); forceteammenu = addmenu("force team", NULL, true, refreshsopmenu);
giveadminmenu = addmenu("give admin", NULL, true, refreshsopmenu); giveadminmenu = addmenu("give admin", NULL, true, refreshsopmenu);
((gmenu *)giveadminmenu)->minrole = CR_ADMIN;
docmenu = addmenu("reference", NULL, true, renderdocmenu); docmenu = addmenu("reference", NULL, true, renderdocmenu);
applymenu = addmenu("apply", "apply changes now?", true, refreshapplymenu); applymenu = addmenu("apply", "apply changes now?", true, refreshapplymenu);
downloaddemomenu = addmenu("Download demo", NULL, true); downloaddemomenu = addmenu("Download demo", NULL, true);
+14
View File
@@ -39,6 +39,11 @@ void showmenu(const char *name, bool top)
} }
gmenu *m = menus.access(name); gmenu *m = menus.access(name);
if(!m) return; if(!m) return;
if(m->minrole > CR_DEFAULT && multiplayer(NULL) && player1->clientrole < m->minrole)
{ // admin-only menu (offline/bot games have no admins, there you're the host and may open everything)
conoutf("\f3this menu is for server admins only");
return;
}
if(!top && curmenu) if(!top && curmenu)
{ {
if(curmenu==m) return; if(curmenu==m) return;
@@ -803,6 +808,7 @@ void *addmenu(const char *name, const char *title, bool allowinput, void (__cdec
m->header = m->footer = NULL; m->header = m->footer = NULL;
m->menusel = 0; m->menusel = 0;
} }
m->minrole = CR_DEFAULT;
m->title = title; m->title = title;
DELSTRING(m->mdl); DELSTRING(m->mdl);
m->allowinput = allowinput; m->allowinput = allowinput;
@@ -904,6 +910,14 @@ void menuinit(char *initaction)
} }
COMMAND(menuinit, "s"); COMMAND(menuinit, "s");
// menuadminonly [role]: the menu that was just created with newmenu can only be opened by admins online (or by players with at least the given role)
void menuadminonly(int *role)
{
if(!lastmenu) return;
lastmenu->minrole = *role > 0 ? *role : CR_ADMIN;
}
COMMAND(menuadminonly, "i");
void menuinitselection(int *line) void menuinitselection(int *line)
{ {
if(!lastmenu) return; if(!lastmenu) return;
+1
View File
@@ -621,6 +621,7 @@ static const int msgsizes[] = // size inclusive message token, 0 f
SV_PAUSEMODE, 1, SV_PAUSEMODE, 1,
SV_GETVITA, 2, SV_VITADATA, 0, SV_GETVITA, 2, SV_VITADATA, 0,
SV_DEATHBLAST, 2, SV_DEATHBLAST, 2,
SV_MATCHSET, 3,
-1 -1
}; };
+3 -2
View File
@@ -7,7 +7,7 @@
#define CUBE_SERVINFO_PORT(serverport) (serverport+1) #define CUBE_SERVINFO_PORT(serverport) (serverport+1)
#define CUBE_SERVINFO_TO_SERV_PORT(servinfoport) (servinfoport-1) #define CUBE_SERVINFO_TO_SERV_PORT(servinfoport) (servinfoport-1)
#define CLIENTIPCENSOR 12 // blank out the last 12 bits of client's IPs before telling them to others (compromise between "16" from AC 0.9x and "8" from AC 1.1) #define CLIENTIPCENSOR 12 // blank out the last 12 bits of client's IPs before telling them to others (compromise between "16" from AC 0.9x and "8" from AC 1.1)
#define PROTOCOL_VERSION 1302 // bump when protocol changes (use negative numbers for mods!) - FORK VERSION #define PROTOCOL_VERSION 1303 // bump when protocol changes (use negative numbers for mods!) - FORK VERSION
#define DEMO_VERSION 2 // bump when demo format changes #define DEMO_VERSION 2 // bump when demo format changes
#define DEMO_MAGIC "ASSAULTCUBE_DEMO" #define DEMO_MAGIC "ASSAULTCUBE_DEMO"
#define DEMO_MINTIME 10000 // don't keep demo recordings with less than 10 seconds #define DEMO_MINTIME 10000 // don't keep demo recordings with less than 10 seconds
@@ -52,6 +52,7 @@ enum
SV_PAUSEMODE, SV_PAUSEMODE,
SV_GETVITA, SV_VITADATA, SV_GETVITA, SV_VITADATA,
SV_DEATHBLAST, SV_DEATHBLAST,
SV_MATCHSET, SV_MATCHSETTINGS,
SV_NUM SV_NUM
}; };
@@ -225,7 +226,7 @@ enum
#define FTXT__MDLATTR (FTXT_NOWHITE | FTXT_ALLOWBLANKS | FTXT_TABTOBLANK | FTXT_NOCOLOR | FTXT_SAFECS) #define FTXT__MDLATTR (FTXT_NOWHITE | FTXT_ALLOWBLANKS | FTXT_TABTOBLANK | FTXT_NOCOLOR | FTXT_SAFECS)
#define FTXT__DEMONAME (FTXT_NOCOLOR | FTXT_MAPNAME | FTXT_ALLOWSLASH) #define FTXT__DEMONAME (FTXT_NOCOLOR | FTXT_MAPNAME | FTXT_ALLOWSLASH)
#define FTXT__DEMOINFO (FTXT_NOCOLOR | FTXT_NOWHITE | FTXT_ALLOWBLANKS) #define FTXT__DEMOINFO (FTXT_NOCOLOR | FTXT_NOWHITE | FTXT_ALLOWBLANKS)
#define FTXT__PLAYERNAME (FTXT_NOWHITE | FTXT_NOCOLOR) #define FTXT__PLAYERNAME (FTXT_NOWHITE | FTXT_NOCOLOR | FTXT_UTF8)
#define FTXT__SERVERINFOLINE (FTXT_ALLOWTAB | FTXT_CROPWHITE_LEAD | FTXT_CROPWHITE_TRAIL) #define FTXT__SERVERINFOLINE (FTXT_ALLOWTAB | FTXT_CROPWHITE_LEAD | FTXT_CROPWHITE_TRAIL)
#define FTXT__SERVERINFO (FTXT_ALLOWTAB | FTXT_ALLOWNL) #define FTXT__SERVERINFO (FTXT_ALLOWTAB | FTXT_ALLOWNL)
#define FTXT__MOTD (FTXT_TABTOBLANK) #define FTXT__MOTD (FTXT_TABTOBLANK)
+5 -4
View File
@@ -244,8 +244,9 @@ struct gmenu
int xoffs, yoffs; int xoffs, yoffs;
char *previewtexture, *previewtexturetitle; char *previewtexture, *previewtexturetitle;
mdirlist *dirlist; mdirlist *dirlist;
int minrole; // CR_DEFAULT = anybody; online, menus with a higher minrole can only be opened by players with at least that role
gmenu() : name(NULL), title(NULL), header(NULL), footer(NULL), menuselinit(-1), initaction(NULL), usefont(NULL), gmenu() : name(NULL), title(NULL), header(NULL), footer(NULL), menuselinit(-1), initaction(NULL), usefont(NULL), minrole(CR_DEFAULT),
allowblink(false), persistentselection(false), synctabstops(false), hasdesc(false), headfootheap(false), allowblink(false), persistentselection(false), synctabstops(false), hasdesc(false), headfootheap(false),
mdl(NULL), footlen(0), xoffs(0), yoffs(0), previewtexture(NULL), previewtexturetitle(NULL), dirlist(NULL) {} mdl(NULL), footlen(0), xoffs(0), yoffs(0), previewtexture(NULL), previewtexturetitle(NULL), dirlist(NULL) {}
virtual ~gmenu() virtual ~gmenu()
@@ -1177,7 +1178,7 @@ struct serverconfigfile
struct servercommandline struct servercommandline
{ {
int uprate, serverport, syslogfacility, filethres, syslogthres, maxdemos, maxclients, kickthreshold, banthreshold, verbose, incoming_limit, afk_limit, ban_time; int uprate, serverport, syslogfacility, filethres, syslogthres, maxdemos, maxclients, kickthreshold, banthreshold, verbose, incoming_limit, afk_limit, ban_time;
const char *ip, *master, *logident, *adminpasswd, *demopath, *maprotfile, *pwdfile, *blfile, *geoipfile, *nbfile, *infopath, *motdpath, *forbidden, *service, *logfilepath, *parfilepath, *ssk, *vitabasename; const char *ip, *master, *logident, *adminpasswd, *demopath, *maprotfile, *pwdfile, *blfile, *geoipfile, *nbfile, *infopath, *motdpath, *service, *logfilepath, *parfilepath, *ssk, *vitabasename;
bool logtimestamp, demo_interm, loggamestatus; bool logtimestamp, demo_interm, loggamestatus;
string motd, servdesc_full, servdesc_pre, servdesc_suf, voteperm, mapperm; string motd, servdesc_full, servdesc_pre, servdesc_suf, voteperm, mapperm;
int clfilenesting; int clfilenesting;
@@ -1187,7 +1188,7 @@ struct servercommandline
maxclients(DEFAULTCLIENTS), kickthreshold(-5), banthreshold(-6), verbose(0), incoming_limit(10), afk_limit(45000), ban_time(20*60*1000), maxclients(DEFAULTCLIENTS), kickthreshold(-5), banthreshold(-6), verbose(0), incoming_limit(10), afk_limit(45000), ban_time(20*60*1000),
ip(""), master(NULL), logident(""), adminpasswd(""), demopath("demos/"), ip(""), master(NULL), logident(""), adminpasswd(""), demopath("demos/"),
maprotfile("config/maprot.cfg"), pwdfile("config/serverpwd.cfg"), blfile("config/serverblacklist.cfg"), geoipfile("config/geoip.cfg"), nbfile("config/nicknameblacklist.cfg"), maprotfile("config/maprot.cfg"), pwdfile("config/serverpwd.cfg"), blfile("config/serverblacklist.cfg"), geoipfile("config/geoip.cfg"), nbfile("config/nicknameblacklist.cfg"),
infopath("config/serverinfo"), motdpath("config/motd"), forbidden("config/forbidden.cfg"), service(NULL), logfilepath("logs/"), parfilepath("config/serverparameters.cfg"), ssk(NULL), vitabasename("config/servervita"), infopath("config/serverinfo"), motdpath("config/motd"), service(NULL), logfilepath("logs/"), parfilepath("config/serverparameters.cfg"), ssk(NULL), vitabasename("config/servervita"),
logtimestamp(false), demo_interm(false), loggamestatus(true), logtimestamp(false), demo_interm(false), loggamestatus(true),
clfilenesting(0) clfilenesting(0)
{ {
@@ -1279,7 +1280,7 @@ struct servercommandline
case 'I': infopath = a; break; case 'I': infopath = a; break;
case 'o': filterrichtext(motd, a); break; case 'o': filterrichtext(motd, a); break;
case 'O': motdpath = a; break; case 'O': motdpath = a; break;
case 'g': forbidden = a; break; case 'g': break; // removed: server profanity filter (forbidden words file)
case 'n': case 'n':
{ {
char *t = servdesc_full; char *t = servdesc_full;
+96 -44
View File
@@ -44,6 +44,60 @@ int matchdeathradius = 100; // blast radius, % of a grenade's
extern int matchdeathpower; extern int matchdeathpower;
int matchdeathpower = 100; // blast damage, % of the default (75% of a grenade's damage at the centre) int matchdeathpower = 100; // blast damage, % of the default (75% of a grenade's damage at the centre)
// movement/weapon feel: the clients apply these, the server only hands them out
int matchrecoilmul = 100, matchspreadmul = 100, matchspeedmul = 100, matchgravity = 100, matchfriction = 100;
// The order of this table is part of the protocol (SV_MATCHSET sends an index, SV_MATCHSETTINGS all values in this order).
matchsettingdef matchsettings[NUMMATCHSETTINGS] =
{
{ "matchrecoilmul", &matchrecoilmul, 0, 100, 500 },
{ "matchspreadmul", &matchspreadmul, 0, 100, 500 },
{ "matchspeedmul", &matchspeedmul, 0, 100, 500 },
{ "matchgravity", &matchgravity, 0, 100, 500 },
{ "matchfriction", &matchfriction, 10, 100, 500 },
{ "matchassist", &matchassist, 0, 1, 1 },
{ "matchfriendlyfire", &matchfriendlyfire, 0, 1, 2 },
{ "matchdeathexplosion", &matchdeathexplosion, 0, 0, 1 },
{ "matchdeathradius", &matchdeathradius, 10, 100, 500 },
{ "matchdeathpower", &matchdeathpower, 0, 100, 500 },
{ "matchspawnprimary", &matchspawnprimary, -1, -1, NUMGUNS-1 },
{ "matchspawnsecondary", &matchspawnsecondary, -1, -1, NUMGUNS-1 },
{ "matchspawntertiary", &matchspawntertiary, -1, -1, NUMGUNS-1 },
{ "matchspawnquaternary", &matchspawnquaternary,-1, -1, NUMGUNS-1 }
};
int matchsynced[NUMMATCHSETTINGS];
void matchsettings_reset()
{
loopi(NUMMATCHSETTINGS) matchsynced[i] = *matchsettings[i].var = matchsettings[i].def;
}
bool matchsetting_apply(int idx, int val)
{
if(idx < 0 || idx >= NUMMATCHSETTINGS) return false;
matchsettingdef &m = matchsettings[idx];
val = clamp(val, m.min, m.max);
matchsynced[idx] = val;
if(*m.var == val) return false;
*m.var = val;
return true;
}
static int __matchsettingsinit = (matchsettings_reset(), 0);
void putmatchsettings(packetbuf &p)
{
putint(p, SV_MATCHSETTINGS);
putint(p, NUMMATCHSETTINGS);
loopi(NUMMATCHSETTINGS) putint(p, *matchsettings[i].var);
}
void sendmatchsettings()
{
packetbuf p(MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
putmatchsettings(p);
sendpacket(-1, 1, p.finalize());
}
struct servergame struct servergame
{ {
int mastermode; int mastermode;
@@ -119,7 +173,6 @@ servermaprot maprot;
serveripblacklist ipblacklist; serveripblacklist ipblacklist;
serveripcclist geoiplist; serveripcclist geoiplist;
servernickblacklist nickblacklist; servernickblacklist nickblacklist;
serverforbiddenlist forbiddenlist;
serverpasswords passwords; serverpasswords passwords;
serverinfofile serverinfoinfo; serverinfofile serverinfoinfo;
serverinfofile serverinfomotd; serverinfofile serverinfomotd;
@@ -2966,6 +3019,7 @@ void disconnect_client(int n, int reason)
if(reason>=0) enet_peer_disconnect(c.peer, reason); if(reason>=0) enet_peer_disconnect(c.peer, reason);
clients[n]->zap(); clients[n]->zap();
sendf(-1, 1, "rii", SV_CDIS, n); sendf(-1, 1, "rii", SV_CDIS, n);
if(numclients() == 0) matchsettings_reset();
if(curvote) curvote->evaluate(); if(curvote) curvote->evaluate();
if(*scoresaved && sg->mastermode == MM_MATCH) senddisconnectedscores(-1); if(*scoresaved && sg->mastermode == MM_MATCH) senddisconnectedscores(-1);
} }
@@ -3125,6 +3179,7 @@ void welcomepacket(packetbuf &p, int n)
putint(p, sendservermode(false)); putint(p, sendservermode(false));
putint(p, SV_PAUSEMODE); putint(p, SV_PAUSEMODE);
putint(p, sg->sispaused); putint(p, sg->sispaused);
putmatchsettings(p);
const char *motd = scl.motd[0] ? scl.motd : serverinfomotd.getmsg(); const char *motd = scl.motd[0] ? scl.motd : serverinfomotd.getmsg();
if(*motd) if(*motd)
{ {
@@ -3164,7 +3219,7 @@ int checktype(int type, client *cl)
SV_CALLVOTESUC, SV_CALLVOTEERR, SV_VOTERESULT, SV_CALLVOTESUC, SV_CALLVOTEERR, SV_VOTERESULT,
SV_SETTEAM, SV_TEAMDENY, SV_SERVERMODE, SV_IPLIST, SV_SETTEAM, SV_TEAMDENY, SV_SERVERMODE, SV_IPLIST,
SV_SENDDEMOLIST, SV_SENDDEMO, SV_DEMOPLAYBACK, SV_SENDDEMOLIST, SV_SENDDEMO, SV_DEMOPLAYBACK,
SV_CLIENT, SV_DEMOCHECKSUM, SV_PAUSEMODE, SV_DEATHBLAST }; SV_CLIENT, SV_DEMOCHECKSUM, SV_PAUSEMODE, SV_DEATHBLAST, SV_MATCHSETTINGS };
// only allow edit messages in coop-edit mode // only allow edit messages in coop-edit mode
static int edittypes[] = { SV_EDITENT, SV_EDITXY, SV_EDITARCH, SV_EDITBLOCK, SV_EDITD, SV_EDITE, SV_NEWMAP }; static int edittypes[] = { SV_EDITENT, SV_EDITXY, SV_EDITARCH, SV_EDITBLOCK, SV_EDITD, SV_EDITE, SV_NEWMAP };
if(cl) if(cl)
@@ -3500,26 +3555,17 @@ void process(ENetPacket *packet, int sender, int chan)
filtertext(text, text, FTXT__CHAT); filtertext(text, text, FTXT__CHAT);
if(*text) if(*text)
{ {
bool canspeech = forbiddenlist.canspeech(text); if(!spamdetect(cl, text)) // team chat
if(!spamdetect(cl, text) && canspeech) // team chat
{ {
mlog(ACLOG_INFO, "[%s] %s%s says to team %s: '%s'", cl->hostname, type == SV_TEAMTEXTME ? "(me) " : "", cl->name, team_string(cl->team), text); mlog(ACLOG_INFO, "[%s] %s%s says to team %s: '%s'", cl->hostname, type == SV_TEAMTEXTME ? "(me) " : "", cl->name, team_string(cl->team), text);
sendteamtext(text, sender, type); sendteamtext(text, sender, type);
} }
else else
{ {
mlog(ACLOG_INFO, "[%s] %s%s says to team %s: '%s', %s", cl->hostname, type == SV_TEAMTEXTME ? "(me) " : "", mlog(ACLOG_INFO, "[%s] %s%s says to team %s: '%s', SPAM detected", cl->hostname, type == SV_TEAMTEXTME ? "(me) " : "",
cl->name, team_string(cl->team), text, canspeech ? "SPAM detected" : "Forbidden speech"); cl->name, team_string(cl->team), text);
if (canspeech) sendservmsg("\f3Please do not spam; your message was not delivered.", sender);
{ if ( cl->spamcount > SPAMMAXREPEAT + 2 ) disconnect_client(cl->clientnum, DISC_SPAM);
sendservmsg("\f3Please do not spam; your message was not delivered.", sender);
if ( cl->spamcount > SPAMMAXREPEAT + 2 ) disconnect_client(cl->clientnum, DISC_SPAM);
}
else
{
sendservmsg("\f3Watch your language! Your message was not delivered.", sender);
kick_abuser(cl->clientnum, cl->badmillis, cl->badspeech, 3);
}
} }
} }
break; break;
@@ -3532,8 +3578,7 @@ void process(ENetPacket *packet, int sender, int chan)
filtertext(text, text, FTXT__CHAT); filtertext(text, text, FTXT__CHAT);
if(*text) if(*text)
{ {
bool canspeech = forbiddenlist.canspeech(text); if(!spamdetect(cl, text))
if(!spamdetect(cl, text) && canspeech)
{ {
if(sg->mastermode != MM_MATCH || !sg->matchteamsize || team_isactive(cl->team) || (cl->team == TEAM_SPECT && cl->role == CR_ADMIN)) // common chat if(sg->mastermode != MM_MATCH || !sg->matchteamsize || team_isactive(cl->team) || (cl->team == TEAM_SPECT && cl->role == CR_ADMIN)) // common chat
{ {
@@ -3551,18 +3596,10 @@ void process(ENetPacket *packet, int sender, int chan)
} }
else else
{ {
mlog(ACLOG_INFO, "[%s] %s%s says: '%s', %s", cl->hostname, type == SV_TEXTME ? "(me) " : "", mlog(ACLOG_INFO, "[%s] %s%s says: '%s', SPAM detected", cl->hostname, type == SV_TEXTME ? "(me) " : "",
cl->name, text, canspeech ? "SPAM detected" : "Forbidden speech"); cl->name, text);
if (canspeech) sendservmsg("\f3Please do not spam; your message was not delivered.", sender);
{ if ( cl->spamcount > SPAMMAXREPEAT + 2 ) disconnect_client(cl->clientnum, DISC_SPAM);
sendservmsg("\f3Please do not spam; your message was not delivered.", sender);
if ( cl->spamcount > SPAMMAXREPEAT + 2 ) disconnect_client(cl->clientnum, DISC_SPAM);
}
else
{
sendservmsg("\f3Watch your language! Your message was not delivered.", sender);
kick_abuser(cl->clientnum, cl->badmillis, cl->badspeech, 3);
}
} }
} }
break; break;
@@ -3579,8 +3616,7 @@ void process(ENetPacket *packet, int sender, int chan)
if(*text) if(*text)
{ {
bool canspeech = forbiddenlist.canspeech(text); if(!spamdetect(cl, text))
if(!spamdetect(cl, text) && canspeech)
{ {
bool allowed = !(sg->mastermode == MM_MATCH && cl->team != target->team) && cl->role >= roleconf('t'); bool allowed = !(sg->mastermode == MM_MATCH && cl->team != target->team) && cl->role >= roleconf('t');
mlog(ACLOG_INFO, "[%s] %s says to %s: '%s' (%s)", cl->hostname, cl->name, target->name, text, allowed ? "allowed":"disallowed"); mlog(ACLOG_INFO, "[%s] %s says to %s: '%s' (%s)", cl->hostname, cl->name, target->name, text, allowed ? "allowed":"disallowed");
@@ -3592,17 +3628,9 @@ void process(ENetPacket *packet, int sender, int chan)
} }
else else
{ {
mlog(ACLOG_INFO, "[%s] %s says to %s: '%s', %s", cl->hostname, cl->name, target->name, text, canspeech ? "SPAM detected" : "Forbidden speech"); mlog(ACLOG_INFO, "[%s] %s says to %s: '%s', SPAM detected", cl->hostname, cl->name, target->name, text);
if (canspeech) sendservmsg("\f3Please do not spam; your message was not delivered.", sender);
{ if ( cl->spamcount > SPAMMAXREPEAT + 2 ) disconnect_client(cl->clientnum, DISC_SPAM);
sendservmsg("\f3Please do not spam; your message was not delivered.", sender);
if ( cl->spamcount > SPAMMAXREPEAT + 2 ) disconnect_client(cl->clientnum, DISC_SPAM);
}
else
{
sendservmsg("\f3Watch your language! Your message was not delivered.", sender);
kick_abuser(cl->clientnum, cl->badmillis, cl->badspeech, 3);
}
} }
} }
} }
@@ -4292,6 +4320,31 @@ void process(ENetPacket *packet, int sender, int chan)
case SV_PAUSEMODE: case SV_PAUSEMODE:
break; break;
case SV_MATCHSET: // admin changes a match setting (idx -1 = reset everything to the defaults)
{
int idx = getint(p), val = getint(p);
if(!cl || cl->role < CR_ADMIN)
{
if(cl) { mlog(ACLOG_INFO, "[%s] player %s tried to change a match setting without being admin", cl->hostname, cl->name); sendservmsg("\f3only an admin can change match settings", sender); }
break;
}
defformatstring(msg)("\f2%s", cl->name);
if(idx == -1)
{
matchsettings_reset();
concatstring(msg, " reset all match settings to the defaults");
}
else
{
if(idx < 0 || idx >= NUMMATCHSETTINGS || !matchsetting_apply(idx, val)) break;
concatformatstring(msg, " set %s to %d", matchsettings[idx].name, *matchsettings[idx].var);
}
mlog(ACLOG_INFO, "[%s] %s", cl->hostname, msg + 2);
sendmatchsettings();
sendservmsg(msg);
break;
}
case SV_GETVITA: case SV_GETVITA:
{ {
int targetcn = getint(p); int targetcn = getint(p);
@@ -5079,7 +5132,6 @@ void initserver(bool dedicated)
ipblacklist.init(scl.blfile); ipblacklist.init(scl.blfile);
geoiplist.init(scl.geoipfile); geoiplist.init(scl.geoipfile);
nickblacklist.init(scl.nbfile); nickblacklist.init(scl.nbfile);
forbiddenlist.init(scl.forbidden);
serverinfoinfo.init(scl.infopath, MAXTRANS / 2); serverinfoinfo.init(scl.infopath, MAXTRANS / 2);
serverinfomotd.init(scl.motdpath, MAXSTRLEN - 5); serverinfomotd.init(scl.motdpath, MAXSTRLEN - 5);
mlog(ACLOG_VERBOSE, "holding up to %d recorded demos in memory", demo_max_number); mlog(ACLOG_VERBOSE, "holding up to %d recorded demos in memory", demo_max_number);
+1 -1
View File
@@ -457,7 +457,7 @@ const char *messagenames[SV_NUM] =
"SV_EXTENSION", "SV_EXTENSION",
"SV_MAPIDENT", "SV_DEMOCHECKSUM", "SV_DEMOSIGNATURE", "SV_MAPIDENT", "SV_DEMOCHECKSUM", "SV_DEMOSIGNATURE",
"SV_PAUSEMODE", "SV_PAUSEMODE",
"SV_GETVITA", "SV_VITADATA", "SV_DEATHBLAST" "SV_GETVITA", "SV_VITADATA", "SV_DEATHBLAST", "SV_MATCHSET", "SV_MATCHSETTINGS"
}; };
const char *entnames[] = const char *entnames[] =
-93
View File
@@ -1400,99 +1400,6 @@ struct servernickblacklist : serverconfigfile
} }
}; };
#define FORBIDDENSIZE 15
bool issimilar (char s, char d)
{
s = tolower(s); d = tolower(d);
if ( s == d ) return true;
switch (d)
{
case 'a': if ( s == '@' || s == '4' ) return true; break;
case 'c': if ( s == 'k' ) return true; break;
case 'e': if ( s == '3' ) return true; break;
case 'i': if ( s == '!' || s == '1' ) return true; break;
case 'o': if ( s == '0' ) return true; break;
case 's': if ( s == '$' || s == '5' ) return true; break;
case 't': if ( s == '7' ) return true; break;
case 'u': if ( s == '#' ) return true; break;
}
return false;
}
bool findpattern (char *s, char *d) // returns true if there is more than 80% of similarity
{
int len, hit = 0;
if (!d || (len = strlen(d)) < 1) return false;
char *dp = d, *s_end = s + strlen(s);
while (s != s_end)
{
if ( *s == ' ' ) // spaces separate words
{
if ( !issimilar(*(s+1),*dp) ) { dp = d; hit = 0; } // d e t e c t i t
}
else if ( issimilar(*s,*dp) ) { dp++; hit++; } // hit!
else if ( hit > 0 ) // this is not a pair, but there is a previous pattern
{
if (*s == '.' || *s == *(s-1) || issimilar(*(s+1),*dp) ); // separator or typo (do nothing)
else if ( issimilar(*(s+1),*(dp+1)) || *s == '*' ) dp++; // wild card or typo
else hit--; // maybe this is nothing
}
else dp = d; // nothing here
s++; // walk on the string
if ( hit && 5 * hit > 4 * len ) return true; // found it!
}
return false;
}
struct serverforbiddenlist : serverconfigfile
{
int num;
char entries[100][2][FORBIDDENSIZE+1]; // 100 entries and 2 words per entry is more than enough
void clear()
{
num = 0;
memset(entries,'\0',2*100*(FORBIDDENSIZE+1));
}
void addentry(char *s)
{
int len = strlen(s);
if ( len > 128 || len < 3 ) return;
int n = 0;
string s1, s2;
char *c1 = s1, *c2 = s2;
if (num < 100 && (n = sscanf(s,"%s %s",s1,s2)) > 0 ) // no warnings
{
copystring(entries[num][0], c1, FORBIDDENSIZE);
if ( n > 1 ) copystring(entries[num][1], c2, FORBIDDENSIZE);
else entries[num][1][0]='\0';
num++;
}
}
void read()
{
char *l, *p = buf;
mlog(ACLOG_VERBOSE,"reading forbidden list '%s'", filename);
while(p < buf + filelen)
{
l = p; p += strlen(p) + 1;
addentry(l);
}
}
bool canspeech(char *s)
{
for (int i=0; i<num; i++){
if ( !findpattern(s,entries[i][0]) ) continue;
else if ( entries[i][1][0] == '\0' || findpattern(s,entries[i][1]) ) return false;
}
return true;
}
};
// serverpwd.cfg // serverpwd.cfg
#define ADMINPWD_MAXPAR 1 #define ADMINPWD_MAXPAR 1
+46 -29
View File
@@ -1041,36 +1041,53 @@ void weapon::attackphysics(vec &from, vec &to) // physical fx to the owner
VARP(righthanded, 0, 1, 1); // flowtron 20090727 VARP(righthanded, 0, 1, 1); // flowtron 20090727
// Match settings (for match mode servers) // Match settings: the values live in server.cpp (table "matchsettings", shared with the server code).
VAR(matchrecoilmul, 0, 100, 500); // 0-500% recoil multiplier // Here they are made available to the console/menus. Online the server owns them: only an admin can change them (by asking
VAR(matchspreadmul, 0, 100, 500); // 0-500% spread multiplier // the server, see matchset below) and everybody else's local changes are undone right away, so nobody can give themselves
VAR(matchspeedmul, 0, 100, 500); // 0-500% speed multiplier // no recoil or low gravity. In offline/bot games you're the host and may set them freely.
VAR(matchgravity, 0, 100, 500); // 0-500% gravity multiplier extern int matchrecoilmul, matchspreadmul;
VAR(matchfriction, 10, 100, 500); // 10-500% friction (grip): low = slippery/ice, high = snappy, no sliding
// These settings are used by the server code (server.cpp), which the client build contains for local/bot games. static void matchsettingchanged()
// They have to be registered as console variables, otherwise the match settings menu can neither set nor read them {
// (that is why the checkboxes were always shown unticked and setting them did nothing). if(multiplayer(NULL)) loopi(NUMMATCHSETTINGS) *matchsettings[i].var = matchsynced[i]; // undo local edits
extern int matchassist; // enable assist system: 0=off, 1=on }
extern int matchfriendlyfire; // friendly fire mode: 0=no damage, 1=normal, 2=no damage + can't shoot teammates
extern int matchspawnprimary; // primary weapon you spawn with (GUN_*), -1 = your own choice static int registermatchsettings()
extern int matchspawnsecondary; // extra guns you spawn with (GUN_*), -1 = none {
extern int matchspawntertiary; loopi(NUMMATCHSETTINGS)
extern int matchspawnquaternary; {
extern int matchdeathexplosion; // "explosive deaths": every death causes an explosion matchsettingdef &m = matchsettings[i];
extern int matchdeathradius; // ... blast radius, % of a grenade's variable(m.name, m.min, m.def, m.max, m.var, matchsettingchanged, false);
extern int matchdeathpower; // ... blast damage, % }
static int __matchsettings = ( return 0;
variable("matchassist", 0, 1, 1, &matchassist, NULL, false), }
variable("matchfriendlyfire", 0, 1, 2, &matchfriendlyfire, NULL, false), static int __matchsettings = registermatchsettings();
variable("matchspawnprimary", -1, -1, NUMGUNS-1, &matchspawnprimary, NULL, false),
variable("matchspawnsecondary", -1, -1, NUMGUNS-1, &matchspawnsecondary, NULL, false), // matchset <setting> <value>: change a match setting. Online this is a request to the server, which only admins may make.
variable("matchspawntertiary", -1, -1, NUMGUNS-1, &matchspawntertiary, NULL, false), void matchset(char *name, int *val)
variable("matchspawnquaternary", -1, -1, NUMGUNS-1, &matchspawnquaternary, NULL, false), {
variable("matchdeathexplosion", 0, 0, 1, &matchdeathexplosion, NULL, false), int idx = -1;
variable("matchdeathradius", 10, 100, 500, &matchdeathradius, NULL, false), loopi(NUMMATCHSETTINGS) if(!strcmp(name, matchsettings[i].name)) { idx = i; break; }
variable("matchdeathpower", 0, 100, 500, &matchdeathpower, NULL, false), if(idx < 0) { conoutf("unknown match setting \"%s\"", name); return; }
0); if(multiplayer(NULL))
{
if(player1->clientrole < CR_ADMIN) { conoutf("\f3only the server admin can change match settings"); return; }
addmsg(SV_MATCHSET, "rii", idx, *val);
}
else matchsetting_apply(idx, *val);
}
COMMAND(matchset, "si");
void matchsetreset()
{
if(multiplayer(NULL))
{
if(player1->clientrole < CR_ADMIN) { conoutf("\f3only the server admin can change match settings"); return; }
addmsg(SV_MATCHSET, "rii", -1, 0);
}
else matchsettings_reset();
}
COMMAND(matchsetreset, "");
// "explosive deaths": effect shown where somebody died (also used for the blast sent by the server) // "explosive deaths": effect shown where somebody died (also used for the blast sent by the server)
void deathblasteffect(const vec &pos) void deathblasteffect(const vec &pos)
-1
View File
@@ -465,7 +465,6 @@
<None Include="..\..\config\font_default.cfg" /> <None Include="..\..\config\font_default.cfg" />
<None Include="..\..\config\font_monospace.cfg" /> <None Include="..\..\config\font_monospace.cfg" />
<None Include="..\..\config\font_serif.cfg" /> <None Include="..\..\config\font_serif.cfg" />
<None Include="..\..\config\forbidden.cfg" />
<None Include="..\..\config\menus_licenses.cfg" /> <None Include="..\..\config\menus_licenses.cfg" />
<None Include="..\..\config\menus_voicecom.cfg" /> <None Include="..\..\config\menus_voicecom.cfg" />
<None Include="..\..\config\motd_en.txt" /> <None Include="..\..\config\motd_en.txt" />
-3
View File
@@ -168,9 +168,6 @@
<None Include="..\..\config\font_serif.cfg"> <None Include="..\..\config\font_serif.cfg">
<Filter>cfg</Filter> <Filter>cfg</Filter>
</None> </None>
<None Include="..\..\config\forbidden.cfg">
<Filter>cfg</Filter>
</None>
<None Include="..\..\config\menus_voicecom.cfg"> <None Include="..\..\config\menus_voicecom.cfg">
<Filter>cfg</Filter> <Filter>cfg</Filter>
</None> </None>