diff --git a/amxmodx/CPlugin.cpp b/amxmodx/CPlugin.cpp
index f9e8b813..a8989633 100755
--- a/amxmodx/CPlugin.cpp
+++ b/amxmodx/CPlugin.cpp
@@ -217,7 +217,7 @@ CPluginMngr::CPlugin* CPluginMngr::findPlugin(int index)
return a;
}
-
+
CPluginMngr::CPlugin* CPluginMngr::findPlugin(const char* name)
{
if (!name)
@@ -236,6 +236,22 @@ CPluginMngr::CPlugin* CPluginMngr::findPlugin(const char* name)
return a;
}
+void CPluginMngr::CPlugin::AddToFailCounter(unsigned int i)
+{
+ failcounter += i;
+ if ((failcounter >= 3)
+ && (status == ps_paused
+ || status == ps_running))
+ {
+ int allow_nongpl = atoi(get_localinfo("allow_nongpl", "0"));
+ if (!allow_nongpl)
+ {
+ errorMsg.assign("This plugin is non-GPL, violating AMX Mod X's license. Edit core.ini to allow this.");
+ status = ps_bad_load;
+ }
+ }
+}
+
const char* CPluginMngr::CPlugin::getStatus() const
{
switch (status)
@@ -263,6 +279,7 @@ CPluginMngr::CPlugin::CPlugin(int i, const char* p, const char* n, char* e, int
{
const char* unk = "unknown";
+ failcounter = 0;
title.assign(unk);
author.assign(unk);
version.assign(unk);
diff --git a/amxmodx/CPlugin.h b/amxmodx/CPlugin.h
index 951d7a17..3c9b5f88 100755
--- a/amxmodx/CPlugin.h
+++ b/amxmodx/CPlugin.h
@@ -71,6 +71,7 @@ public:
String author;
String errorMsg;
+ unsigned int failcounter;
int m_PauseFwd;
int m_UnpauseFwd;
int paused_fun;
@@ -102,6 +103,7 @@ public:
inline bool isExecutable(int id) const { return (isValid() && !isPaused()); }
void Finalize();
+ void AddToFailCounter(unsigned int i);
void pausePlugin();
void unpausePlugin();
void pauseFunction(int id);
diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp
index 0dfb0a79..6c289e5f 100755
--- a/amxmodx/amxmodx.cpp
+++ b/amxmodx/amxmodx.cpp
@@ -35,9 +35,26 @@
#include "debugger.h"
#include "binlog.h"
#include "libraries.h"
+#include "nongpl_matches.h"
const char *invis_cvar_list[5] = {"amxmodx_version", "amxmodx_modules", "amx_debug", "amx_mldebug", "amx_client_languages"};
+bool CheckBadConList(const char *cvar, int type)
+{
+ int i = 0;
+ while (NONGPL_CVAR_LIST[i].cvar != NULL)
+ {
+ if (NONGPL_CVAR_LIST[i].type == type
+ && strcmp(NONGPL_CVAR_LIST[i].cvar, cvar) == 0)
+ {
+ return true;
+ }
+ i++;
+ }
+
+ return false;
+}
+
static cell AMX_NATIVE_CALL get_xvar_id(AMX *amx, cell *params)
{
int len;
@@ -1087,6 +1104,31 @@ static cell AMX_NATIVE_CALL register_plugin(AMX *amx, cell *params) /* 3 param *
a->setTitle(title);
a->setVersion(vers);
a->setAuthor(author);
+
+ /* Check if we need to add fail counters */
+ i = 0;
+ unsigned int counter = 0;
+ while (NONGPL_PLUGIN_LIST[i].author != NULL)
+ {
+ if (strcmp(NONGPL_PLUGIN_LIST[i].author, author) == 0)
+ {
+ counter++;
+ }
+ if (stricmp(NONGPL_PLUGIN_LIST[i].filename, a->getName()) == 0)
+ {
+ counter++;
+ }
+ if (stricmp(NONGPL_PLUGIN_LIST[i].title, title) == 0)
+ {
+ counter++;
+ }
+ if (counter)
+ {
+ a->AddToFailCounter(counter);
+ break;
+ }
+ i++;
+ }
return a->getId();
}
@@ -1215,6 +1257,11 @@ static cell AMX_NATIVE_CALL register_concmd(AMX *amx, cell *params) /* 4 param *
if ((cmd = g_commands.registerCommand(plugin, idx, temp, info, access, listable)) == NULL)
return 0;
+
+ if (CheckBadConList(temp, 1))
+ {
+ plugin->AddToFailCounter(1);
+ }
cmd->setCmdType(CMD_ConsoleCommand);
REG_SVR_COMMAND((char*)cmd->getCommand(), plugin_srvcmd);
@@ -2295,10 +2342,15 @@ static cell AMX_NATIVE_CALL register_cvar(AMX *amx, cell *params) /* 3 param */
{
int i;
char* temp = get_amxstring(amx, params[1], 0, i);
+ CPluginMngr::CPlugin *plugin = g_plugins.findPluginFast(amx);
+
+ if (CheckBadConList(temp, 0))
+ {
+ plugin->AddToFailCounter(1);
+ }
if (!g_cvars.find(temp))
{
- CPluginMngr::CPlugin *plugin = g_plugins.findPluginFast(amx);
CCVar* cvar = new CCVar(temp, plugin->getName(), params[3], amx_ctof(params[4]));
cvar->plugin_id = plugin->getId();
diff --git a/amxmodx/msvc/amxmodx_mm.vcproj b/amxmodx/msvc/amxmodx_mm.vcproj
index db2b47b9..c3bf6972 100755
--- a/amxmodx/msvc/amxmodx_mm.vcproj
+++ b/amxmodx/msvc/amxmodx_mm.vcproj
@@ -439,6 +439,9 @@
+
+
@@ -581,6 +584,9 @@
+
+
diff --git a/amxmodx/msvc8/amxmodx_mm.vcproj b/amxmodx/msvc8/amxmodx_mm.vcproj
index 3451043c..114f0edb 100644
--- a/amxmodx/msvc8/amxmodx_mm.vcproj
+++ b/amxmodx/msvc8/amxmodx_mm.vcproj
@@ -609,6 +609,10 @@
RelativePath="..\newmenus.cpp"
>
+
+
@@ -794,6 +798,10 @@
RelativePath="..\newmenus.h"
>
+
+
diff --git a/amxmodx/nongpl_matches.cpp b/amxmodx/nongpl_matches.cpp
new file mode 100644
index 00000000..6e94a32b
--- /dev/null
+++ b/amxmodx/nongpl_matches.cpp
@@ -0,0 +1,22 @@
+#include
+#include "nongpl_matches.h"
+
+NONGPL_PLUGIN_T NONGPL_PLUGIN_LIST[] =
+{
+ {"Live", "CZ Gun Game", "czgungame.amxx"},
+ {NULL, NULL, NULL},
+};
+
+NONGPL_CVAR_T NONGPL_CVAR_LIST[] =
+{
+ {"gg_mode", 0},
+ {"gg_warmuptimer", 0},
+ {"gg_ff", 0},
+ {"gg_fflevel", 0},
+ {"gg_stats", 0},
+ {"gg_dm", 0},
+ {"gg_turbo", 0},
+ {"amx_ggreset", 1},
+ {"amx_gg", 1},
+ {NULL, 0},
+};
diff --git a/amxmodx/nongpl_matches.h b/amxmodx/nongpl_matches.h
new file mode 100644
index 00000000..eec0e4f5
--- /dev/null
+++ b/amxmodx/nongpl_matches.h
@@ -0,0 +1,51 @@
+/* AMX Mod X
+*
+* by the AMX Mod X Development Team
+* originally developed by OLO
+*
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation; either version 2 of the License, or (at
+* your option) any later version.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software Foundation,
+* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*
+* In addition, as a special exception, the author gives permission to
+* link the code of this program with the Half-Life Game Engine ("HL
+* Engine") and Modified Game Libraries ("MODs") developed by Valve,
+* L.L.C ("Valve"). You must obey the GNU General Public License in all
+* respects for all of the code used other than the HL Engine and MODs
+* from Valve. If you modify this file, you may extend this exception
+* to your version of the file, but you are not obligated to do so. If
+* you do not wish to do so, delete this exception statement from your
+* version.
+*/
+
+#ifndef _INCLUDE_AMXMODX_NONGPL_MATCHES_H_
+#define _INCLUDE_AMXMODX_NONGPL_MATCHES_H_
+
+struct NONGPL_PLUGIN_T
+{
+ const char *author;
+ const char *title;
+ const char *filename;
+};
+
+struct NONGPL_CVAR_T
+{
+ const char *cvar;
+ int type;
+};
+
+extern NONGPL_PLUGIN_T NONGPL_PLUGIN_LIST[];
+extern NONGPL_CVAR_T NONGPL_CVAR_LIST[];
+
+#endif //_INCLUDE_AMXMODX_NONGPL_MATCHES_H_
diff --git a/configs/core.ini b/configs/core.ini
index a1fc0f8d..a511eb00 100755
--- a/configs/core.ini
+++ b/configs/core.ini
@@ -37,3 +37,18 @@ max_binlog_size 20
; 2 - float comparisons
; 4 - float rounding
optimizer 7
+
+; AMX Mod X is licensed under the GPL, an open source
+; license that requires plugin source code to be
+; freely available. While this is our policy, there
+; are some unscrupulous authors that violate this
+; license and thus your right to see and modify their
+; source code.
+;
+; In order to make users aware of this situation,
+; plugins which violate our terms have been blocked
+; from loading. If you are aware of your rights and
+; the AMX Mod X license, and don't mind running plugins
+; which are trying to take away your rights, change
+; the 0 on the following line to 1.
+allow_nongpl 0
\ No newline at end of file
diff --git a/configs/cstrike/core.ini b/configs/cstrike/core.ini
index 1f49c0c7..ecda0181 100755
--- a/configs/cstrike/core.ini
+++ b/configs/cstrike/core.ini
@@ -39,3 +39,18 @@ max_binlog_size 20
; 2 - float comparisons
; 4 - float rounding
optimizer 7
+
+; AMX Mod X is licensed under the GPL, an open source
+; license that requires plugin source code to be
+; freely available. While this is our policy, there
+; are some unscrupulous authors that violate this
+; license and thus your right to see and modify their
+; source code.
+;
+; In order to make users aware of this situation,
+; plugins which violate our terms have been blocked
+; from loading. If you are aware of your rights and
+; the AMX Mod X license, and don't mind running plugins
+; which are trying to take away your rights, change
+; the 0 on the following line to 1.
+allow_nongpl 0
\ No newline at end of file
diff --git a/configs/dod/core.ini b/configs/dod/core.ini
index ee6097bd..b3f96686 100755
--- a/configs/dod/core.ini
+++ b/configs/dod/core.ini
@@ -40,3 +40,18 @@ max_binlog_size 20
; 2 - float comparisons
; 4 - float rounding
optimizer 7
+
+; AMX Mod X is licensed under the GPL, an open source
+; license that requires plugin source code to be
+; freely available. While this is our policy, there
+; are some unscrupulous authors that violate this
+; license and thus your right to see and modify their
+; source code.
+;
+; In order to make users aware of this situation,
+; plugins which violate our terms have been blocked
+; from loading. If you are aware of your rights and
+; the AMX Mod X license, and don't mind running plugins
+; which are trying to take away your rights, change
+; the 0 on the following line to 1.
+allow_nongpl 0
\ No newline at end of file
diff --git a/configs/tfc/core.ini b/configs/tfc/core.ini
index ee7245ac..b8a861ea 100755
--- a/configs/tfc/core.ini
+++ b/configs/tfc/core.ini
@@ -39,3 +39,18 @@ max_binlog_size 20
; 2 - float comparisons
; 4 - float rounding
optimizer 7
+
+; AMX Mod X is licensed under the GPL, an open source
+; license that requires plugin source code to be
+; freely available. While this is our policy, there
+; are some unscrupulous authors that violate this
+; license and thus your right to see and modify their
+; source code.
+;
+; In order to make users aware of this situation,
+; plugins which violate our terms have been blocked
+; from loading. If you are aware of your rights and
+; the AMX Mod X license, and don't mind running plugins
+; which are trying to take away your rights, change
+; the 0 on the following line to 1.
+allow_nongpl 0
\ No newline at end of file
diff --git a/configs/ts/core.ini b/configs/ts/core.ini
index a98c69cb..7f458e86 100755
--- a/configs/ts/core.ini
+++ b/configs/ts/core.ini
@@ -39,3 +39,18 @@ max_binlog_size 20
; 2 - float comparisons
; 4 - float rounding
optimizer 7
+
+; AMX Mod X is licensed under the GPL, an open source
+; license that requires plugin source code to be
+; freely available. While this is our policy, there
+; are some unscrupulous authors that violate this
+; license and thus your right to see and modify their
+; source code.
+;
+; In order to make users aware of this situation,
+; plugins which violate our terms have been blocked
+; from loading. If you are aware of your rights and
+; the AMX Mod X license, and don't mind running plugins
+; which are trying to take away your rights, change
+; the 0 on the following line to 1.
+allow_nongpl 0
\ No newline at end of file