From a31be1d18e46de280e35cd00aa3d538901c1d3c3 Mon Sep 17 00:00:00 2001 From: s1lent Date: Tue, 9 Apr 2019 17:25:20 +0700 Subject: [PATCH] Added mp_allow_point_servercommand to disable point_servercommand entities. Due to a high risk of abuse, it is gated by the mp_allow_point_servercommand console variable. --- README.md | 2 ++ dist/game.cfg | 8 ++++++++ regamedll/dlls/addons/point_command.cpp | 7 +++++++ regamedll/dlls/game.cpp | 3 +++ regamedll/dlls/game.h | 1 + 5 files changed, 21 insertions(+) diff --git a/README.md b/README.md index bb2dfea6..526307ff 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,8 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure' | mp_item_staytime | 300 | - | - | Time to remove item that have been dropped from the players. | | mp_legacy_bombtarget_touch | 1 | 0 | 1 | Legacy func_bomb_target touch. New one is more strict.
`0` New behavior
`1` Legacy behavior| | mp_respawn_immunitytime | 0 | 0 | - | Specifies the players defense time after respawn. (in seconds).
`0` disabled
`>0.00001` time delay to remove protection | +| mp_kill_filled_spawn | 1 | 0 | 1 | Kill the player in filled spawn before spawning some one else (Prevents players stucking in each other).
Only disable this if you have semiclip or other plugins that prevents stucking.
`0` disabled
`1` enabled | +| mp_allow_point_servercommand | 0 | 0 | 1 | Allow use of point_servercommand entities in map.
`0` disallow
`1` allow
`NOTE`: Potentially dangerous for untrusted maps.| ## How to install zBot for CS 1.6? * Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true) diff --git a/dist/game.cfg b/dist/game.cfg index f9e97102..cc0711d7 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -201,3 +201,11 @@ mp_respawn_immunitytime "0" // // Default value: "1" mp_kill_filled_spawn "1" + +// Allow use of point_servercommand entities in map. +// NOTE: Potentially dangerous for untrusted maps. +// 0 - disallow +// 1 - allow +// +// Default value: "0" +mp_allow_point_servercommand "0" diff --git a/regamedll/dlls/addons/point_command.cpp b/regamedll/dlls/addons/point_command.cpp index ed5279d0..7ac78d25 100644 --- a/regamedll/dlls/addons/point_command.cpp +++ b/regamedll/dlls/addons/point_command.cpp @@ -71,6 +71,13 @@ LINK_ENTITY_TO_CLASS(point_servercommand, CPointServerCommand, CCSPointServerCom void CPointServerCommand::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { +#ifdef REGAMEDLL_ADD + if (!allow_point_servercommand.value) { + ALERT(at_warning, "point_servercommand usage blocked by mp_allow_point_servercommand setting\n"); + return; + } +#endif + for (size_t cmd = 0; cmd < m_uiCommandsCount; cmd++) { Execute(m_iszCommands[cmd]); } diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index 0f74a479..6065242f 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -119,6 +119,8 @@ cvar_t legacy_bombtarget_touch = { "mp_legacy_bombtarget_touch", "1", FCVAR_SERV cvar_t respawn_immunitytime = { "mp_respawn_immunitytime", "0", FCVAR_SERVER, 0.0f, nullptr }; cvar_t kill_filled_spawn = { "mp_kill_filled_spawn", "1", FCVAR_SERVER, 0.0f, nullptr }; +cvar_t allow_point_servercommand = { "mp_allow_point_servercommand", "0", 0, 0.0f, nullptr }; + void GameDLL_Version_f() { if (Q_stricmp(CMD_ARGV(1), "version") != 0) @@ -288,6 +290,7 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&legacy_bombtarget_touch); CVAR_REGISTER(&respawn_immunitytime); CVAR_REGISTER(&kill_filled_spawn); + CVAR_REGISTER(&allow_point_servercommand); // print version CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n"); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index e00ee05b..6bda9f9f 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -155,6 +155,7 @@ extern cvar_t item_staytime; extern cvar_t legacy_bombtarget_touch; extern cvar_t respawn_immunitytime; extern cvar_t kill_filled_spawn; +extern cvar_t allow_point_servercommand; #endif