added non-gpl plugin blocking (wow i can't believe it came to this)
This commit is contained in:
parent
1f1edef98d
commit
109b1e45b5
|
@ -217,7 +217,7 @@ CPluginMngr::CPlugin* CPluginMngr::findPlugin(int index)
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
CPluginMngr::CPlugin* CPluginMngr::findPlugin(const char* name)
|
CPluginMngr::CPlugin* CPluginMngr::findPlugin(const char* name)
|
||||||
{
|
{
|
||||||
if (!name)
|
if (!name)
|
||||||
|
@ -236,6 +236,22 @@ CPluginMngr::CPlugin* CPluginMngr::findPlugin(const char* name)
|
||||||
return a;
|
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
|
const char* CPluginMngr::CPlugin::getStatus() const
|
||||||
{
|
{
|
||||||
switch (status)
|
switch (status)
|
||||||
|
@ -263,6 +279,7 @@ CPluginMngr::CPlugin::CPlugin(int i, const char* p, const char* n, char* e, int
|
||||||
{
|
{
|
||||||
const char* unk = "unknown";
|
const char* unk = "unknown";
|
||||||
|
|
||||||
|
failcounter = 0;
|
||||||
title.assign(unk);
|
title.assign(unk);
|
||||||
author.assign(unk);
|
author.assign(unk);
|
||||||
version.assign(unk);
|
version.assign(unk);
|
||||||
|
|
|
@ -71,6 +71,7 @@ public:
|
||||||
String author;
|
String author;
|
||||||
String errorMsg;
|
String errorMsg;
|
||||||
|
|
||||||
|
unsigned int failcounter;
|
||||||
int m_PauseFwd;
|
int m_PauseFwd;
|
||||||
int m_UnpauseFwd;
|
int m_UnpauseFwd;
|
||||||
int paused_fun;
|
int paused_fun;
|
||||||
|
@ -102,6 +103,7 @@ public:
|
||||||
inline bool isExecutable(int id) const { return (isValid() && !isPaused()); }
|
inline bool isExecutable(int id) const { return (isValid() && !isPaused()); }
|
||||||
|
|
||||||
void Finalize();
|
void Finalize();
|
||||||
|
void AddToFailCounter(unsigned int i);
|
||||||
void pausePlugin();
|
void pausePlugin();
|
||||||
void unpausePlugin();
|
void unpausePlugin();
|
||||||
void pauseFunction(int id);
|
void pauseFunction(int id);
|
||||||
|
|
|
@ -35,9 +35,26 @@
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
#include "binlog.h"
|
#include "binlog.h"
|
||||||
#include "libraries.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"};
|
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)
|
static cell AMX_NATIVE_CALL get_xvar_id(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
@ -1087,6 +1104,31 @@ static cell AMX_NATIVE_CALL register_plugin(AMX *amx, cell *params) /* 3 param *
|
||||||
a->setTitle(title);
|
a->setTitle(title);
|
||||||
a->setVersion(vers);
|
a->setVersion(vers);
|
||||||
a->setAuthor(author);
|
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();
|
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)
|
if ((cmd = g_commands.registerCommand(plugin, idx, temp, info, access, listable)) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (CheckBadConList(temp, 1))
|
||||||
|
{
|
||||||
|
plugin->AddToFailCounter(1);
|
||||||
|
}
|
||||||
|
|
||||||
cmd->setCmdType(CMD_ConsoleCommand);
|
cmd->setCmdType(CMD_ConsoleCommand);
|
||||||
REG_SVR_COMMAND((char*)cmd->getCommand(), plugin_srvcmd);
|
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;
|
int i;
|
||||||
char* temp = get_amxstring(amx, params[1], 0, 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))
|
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]));
|
CCVar* cvar = new CCVar(temp, plugin->getName(), params[3], amx_ctof(params[4]));
|
||||||
|
|
||||||
cvar->plugin_id = plugin->getId();
|
cvar->plugin_id = plugin->getId();
|
||||||
|
|
|
@ -439,6 +439,9 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="..\newmenus.cpp">
|
RelativePath="..\newmenus.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\nongpl_matches.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\optimizer.cpp">
|
RelativePath="..\optimizer.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
@ -581,6 +584,9 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="..\newmenus.h">
|
RelativePath="..\newmenus.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\nongpl_matches.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\optimizer.h">
|
RelativePath="..\optimizer.h">
|
||||||
</File>
|
</File>
|
||||||
|
|
|
@ -609,6 +609,10 @@
|
||||||
RelativePath="..\newmenus.cpp"
|
RelativePath="..\newmenus.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\nongpl_matches.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\optimizer.cpp"
|
RelativePath="..\optimizer.cpp"
|
||||||
>
|
>
|
||||||
|
@ -794,6 +798,10 @@
|
||||||
RelativePath="..\newmenus.h"
|
RelativePath="..\newmenus.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\nongpl_matches.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\optimizer.h"
|
RelativePath="..\optimizer.h"
|
||||||
>
|
>
|
||||||
|
|
22
amxmodx/nongpl_matches.cpp
Normal file
22
amxmodx/nongpl_matches.cpp
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#include <string.h>
|
||||||
|
#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},
|
||||||
|
};
|
51
amxmodx/nongpl_matches.h
Normal file
51
amxmodx/nongpl_matches.h
Normal file
|
@ -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_
|
|
@ -37,3 +37,18 @@ max_binlog_size 20
|
||||||
; 2 - float comparisons
|
; 2 - float comparisons
|
||||||
; 4 - float rounding
|
; 4 - float rounding
|
||||||
optimizer 7
|
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
|
|
@ -39,3 +39,18 @@ max_binlog_size 20
|
||||||
; 2 - float comparisons
|
; 2 - float comparisons
|
||||||
; 4 - float rounding
|
; 4 - float rounding
|
||||||
optimizer 7
|
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
|
|
@ -40,3 +40,18 @@ max_binlog_size 20
|
||||||
; 2 - float comparisons
|
; 2 - float comparisons
|
||||||
; 4 - float rounding
|
; 4 - float rounding
|
||||||
optimizer 7
|
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
|
|
@ -39,3 +39,18 @@ max_binlog_size 20
|
||||||
; 2 - float comparisons
|
; 2 - float comparisons
|
||||||
; 4 - float rounding
|
; 4 - float rounding
|
||||||
optimizer 7
|
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
|
|
@ -39,3 +39,18 @@ max_binlog_size 20
|
||||||
; 2 - float comparisons
|
; 2 - float comparisons
|
||||||
; 4 - float rounding
|
; 4 - float rounding
|
||||||
optimizer 7
|
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
|
Loading…
Reference in New Issue
Block a user