From ce6da87106a73fa6f1cfbeb31de29978643410f3 Mon Sep 17 00:00:00 2001 From: byjumpe Date: Fri, 8 Dec 2023 20:21:45 +0500 Subject: [PATCH 1/2] New MapManager (test) --- .../amxmodx/scripting/regg_mapmanager.sma | 76 ++++++++++++++++++- 1 file changed, 74 insertions(+), 2 deletions(-) diff --git a/cstrike/addons/amxmodx/scripting/regg_mapmanager.sma b/cstrike/addons/amxmodx/scripting/regg_mapmanager.sma index 3c33f67..914d355 100644 --- a/cstrike/addons/amxmodx/scripting/regg_mapmanager.sma +++ b/cstrike/addons/amxmodx/scripting/regg_mapmanager.sma @@ -1,7 +1,9 @@ #include +#include #include -new VoteType; +new VoteType, gMapNums; +new Array:gMapName; public plugin_init() { register_plugin("[ReGG] Map Manager", REGG_VERSION_STR, "Jumper & d3m37r4"); @@ -9,8 +11,12 @@ public plugin_init() { bind_pcvar_num(create_cvar( "regg_mapchange_type", "1", .has_min = true, - .min_val = 1.0 + .min_val = 0.0 ), VoteType); + + gMapName = ArrayCreate(MAX_NAME_LENGTH); + + loadMapCfg(); } public ReGG_FinishPost(const killer, const victim) { @@ -19,6 +25,13 @@ public ReGG_FinishPost(const killer, const victim) { public MapChange() { switch(VoteType){ + case 0: { + new mapname[MAX_NAME_LENGTH]; + ArrayGetString(gMapName, random(gMapNums), mapname, charsmax(mapname)); + message_begin(MSG_ALL, SVC_INTERMISSION); + message_end(); + engine_changelevel(mapname); + } case 1: { server_cmd("mapm_start_vote"); } @@ -30,3 +43,62 @@ public MapChange() { } } } + +loadMapCfg() { + new maps_file[PLATFORM_MAX_PATH]; + get_configsdir(maps_file, charsmax(maps_file)); + format(maps_file, charsmax(maps_file), "%s/maps.ini", maps_file); + + if(!file_exists(maps_file)) { + get_cvar_string("mapcyclefile", maps_file, charsmax(maps_file)); + } + + if(!file_exists(maps_file)) { + format(maps_file, charsmax(maps_file), "mapcycle.txt") + } + + loadMapsFile(maps_file); +} + +loadMapsFile(file[]) { + new iFile = fopen(file, "rt"); + if(!iFile) { + set_fail_state("File ^"%s^" is not found", file); + } + + new szBuffer[PLATFORM_MAX_PATH], szMaps[MAX_NAME_LENGTH]; + while(!feof(iFile)) { + fgets(iFile, szBuffer, charsmax(szBuffer)); + parse(szBuffer, szMaps, charsmax(szMaps)); + + if(!szBuffer[0] || szBuffer[0] == ';' || !isValidMap(szMaps)) { + continue; + } + + ArrayPushString(gMapName, szMaps); + gMapNums++; + } + + fclose(iFile); +} + +stock bool:isValidMap(mapname[]) { + if (is_map_valid(mapname)){ + return true; + } + + new len = strlen(mapname) - 4; + if (len < 0) { + return false; + } + + if (equali(mapname[len], ".bsp")){ + mapname[len] = '^0'; + + if (is_map_valid(mapname)) { + return true; + } + } + + return false; +} From 9d1437fae824ea8fa2434747be399e829a5f58d2 Mon Sep 17 00:00:00 2001 From: byjumpe Date: Sat, 9 Dec 2023 12:48:46 +0500 Subject: [PATCH 2/2] Up version, fix in regg-main.cfg --- cstrike/addons/amxmodx/configs/regg/regg-main.cfg | 6 ++---- cstrike/addons/amxmodx/scripting/include/regg.inc | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cstrike/addons/amxmodx/configs/regg/regg-main.cfg b/cstrike/addons/amxmodx/configs/regg/regg-main.cfg index 1f2c3ca..9676f67 100644 --- a/cstrike/addons/amxmodx/configs/regg/regg-main.cfg +++ b/cstrike/addons/amxmodx/configs/regg/regg-main.cfg @@ -4,9 +4,6 @@ // 2 - FFA regg_mode "0" -// Восстановление гранаты на уровне Hegrenade после броска -regg_nade_refresh "5.0" - // Режим Knife Pro позволяет украсть посредством // убийства с ножа уровень либо очки // Настройка не распространяется на режим командной игры @@ -22,10 +19,11 @@ regg_steal_value "1" regg_team_steal_value "3" // Смена карты, какой плагин использовать +// 0 - ReGG Map Manager, a random map from the maplist (maps.ini or mapcycle.txt) // 1 - Map Manager by Mistrik (v. 3.0.7) // 2 - MapChooser RBS by SKAJIbnEJIb // 3 - Map Manager by Mistrik (v. 2.5.61) -regg_mapchange_type "1" +regg_mapchange_type "0" // Оружие AWP имеет 1 выстрел, перезарядка если не убили regg_awp_oneshot "1" diff --git a/cstrike/addons/amxmodx/scripting/include/regg.inc b/cstrike/addons/amxmodx/scripting/include/regg.inc index c553c64..6b683d0 100644 --- a/cstrike/addons/amxmodx/scripting/include/regg.inc +++ b/cstrike/addons/amxmodx/scripting/include/regg.inc @@ -21,7 +21,7 @@ #define REGG_MAJOR_VERSION 0 #define REGG_MINOR_VERSION 4 -#define REGG_MAINTENANCE_VERSION 36 +#define REGG_MAINTENANCE_VERSION 38 #define REGG_VERSION str_to_num(fmt("%d%d%d", REGG_MAJOR_VERSION, REGG_MINOR_VERSION, REGG_MAINTENANCE_VERSION)) #define REGG_VERSION_STR fmt("%d.%d.%d-alpha", REGG_MAJOR_VERSION, REGG_MINOR_VERSION, REGG_MAINTENANCE_VERSION)