From c1d0f08fdcf6e32201ad94298d3925db6b3e721e Mon Sep 17 00:00:00 2001 From: byjumpe Date: Mon, 11 Dec 2023 19:29:45 +0500 Subject: [PATCH 1/6] fix points --- .../amxmodx/scripting/regg/functions.inl | 44 ++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/cstrike/addons/amxmodx/scripting/regg/functions.inl b/cstrike/addons/amxmodx/scripting/regg/functions.inl index 28ce17f..8fbf282 100644 --- a/cstrike/addons/amxmodx/scripting/regg/functions.inl +++ b/cstrike/addons/amxmodx/scripting/regg/functions.inl @@ -334,9 +334,25 @@ ReGG_Result:addPlayerPoints(const id, const value, const bool:forwards = true) { break; } - points -= needPoints; - needPoints = Levels[level][LevelPoints]; - result = ReGG_ResultLevelUp; + switch(Levels[level][LevelWeaponID]) { + case WEAPON_KNIFE: { + points = 0; + needPoints = Levels[level][LevelPoints]; + result = ReGG_ResultLevelUp; + } + + case WEAPON_HEGRENADE: { + points = 0; + needPoints = Levels[level][LevelPoints]; + result = ReGG_ResultLevelUp; + } + + default: { + points -= needPoints; + needPoints = Levels[level][LevelPoints]; + result = ReGG_ResultLevelUp; + } + } } if(result != ReGG_ResultPointsUp && !setPlayerLevel(id, level, forwards)) { @@ -364,9 +380,25 @@ ReGG_Result:addTeamPoints(const slot, const value, const bool:forwards = true) { break; } - points -= needPoints; - needPoints = getTeamLevelPoints(slot, level); - result = ReGG_ResultLevelUp; + switch(Levels[level][LevelWeaponID]) { + case WEAPON_KNIFE: { + points = 0; + needPoints = getTeamLevelPoints(slot, level); + result = ReGG_ResultLevelUp; + } + + case WEAPON_HEGRENADE: { + points = 0; + needPoints = getTeamLevelPoints(slot, level); + result = ReGG_ResultLevelUp; + } + + default: { + points -= needPoints; + needPoints = getTeamLevelPoints(slot, level); + result = ReGG_ResultLevelUp; + } + } } if(result != ReGG_ResultPointsUp && !setTeamLevel(slot, level, forwards)) { From e18015298155b2dc1c07734d2aa65a0b682ee8e1 Mon Sep 17 00:00:00 2001 From: byjumpe Date: Mon, 18 Dec 2023 20:03:43 +0500 Subject: [PATCH 2/6] Rename LevelMod * renamed Level Mod to LevelRatio, for a better understanding of the setting --- .../amxmodx/configs/regg/regg-levels.ini | 18 +++++++++--------- .../addons/amxmodx/scripting/regg/config.inl | 2 +- .../amxmodx/scripting/regg/functions.inl | 2 +- cstrike/addons/amxmodx/scripting/regg_core.sma | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cstrike/addons/amxmodx/configs/regg/regg-levels.ini b/cstrike/addons/amxmodx/configs/regg/regg-levels.ini index 06a1e3c..bfdf159 100644 --- a/cstrike/addons/amxmodx/configs/regg/regg-levels.ini +++ b/cstrike/addons/amxmodx/configs/regg/regg-levels.ini @@ -5,52 +5,52 @@ weapon=weapon_glock18 title=Deagle weapon=weapon_deagle points=2 -mod=100 +ratio=100 [LEVEL] title=USP weapon=weapon_usp points=2 -mod=100 +ratio=100 [LEVEL] title=Glock-18 weapon=weapon_glock18 points=2 -mod=100 +ratio=100 [LEVEL] title=M4A1 weapon=weapon_m4a1 points=3 -mod=100 +ratio=100 [LEVEL] title=AK-47 weapon=weapon_ak47 points=3 -mod=100 +ratio=100 [LEVEL] title=Scout weapon=weapon_scout points=2 -mod=100 +ratio=100 [LEVEL] title=AWP weapon=weapon_awp points=2 -mod=100 +ratio=100 [LEVEL] title=Hegrenade weapon=weapon_hegrenade points=1 -mod=50 +ratio=50 [LEVEL] title=Knife weapon=weapon_knife points=1 -mod=33 \ No newline at end of file +ratio=33 \ No newline at end of file diff --git a/cstrike/addons/amxmodx/scripting/regg/config.inl b/cstrike/addons/amxmodx/scripting/regg/config.inl index cf913c3..ca8b4be 100644 --- a/cstrike/addons/amxmodx/scripting/regg/config.inl +++ b/cstrike/addons/amxmodx/scripting/regg/config.inl @@ -329,7 +329,7 @@ public bool:ConfigOnKeyValue(const INIParser:handle, const key[], const value[]) } else if (strcmp(key, "points") == 0) { Levels[LevelsNum][LevelPoints] = str_to_num(value); } else if (strcmp(key, "mod") == 0) { - Levels[LevelsNum][LevelMod] = str_to_num(value); + Levels[LevelsNum][LevelRatio] = str_to_num(value); } } } diff --git a/cstrike/addons/amxmodx/scripting/regg/functions.inl b/cstrike/addons/amxmodx/scripting/regg/functions.inl index 8fbf282..9a67dcf 100644 --- a/cstrike/addons/amxmodx/scripting/regg/functions.inl +++ b/cstrike/addons/amxmodx/scripting/regg/functions.inl @@ -645,7 +645,7 @@ getTeamSlot(const id) { getTeamLevelPoints(const slot, const level) { new points; new point_s = getTeamPlayers(slot) * Levels[level][LevelPoints]; - new lvlmod = Levels[level][LevelMod]; + new lvlmod = Levels[level][LevelRatio]; if(lvlmod != 100) { points = roundPoints(lvlmod, point_s); } else { diff --git a/cstrike/addons/amxmodx/scripting/regg_core.sma b/cstrike/addons/amxmodx/scripting/regg_core.sma index 3563fe1..d38a0b1 100644 --- a/cstrike/addons/amxmodx/scripting/regg_core.sma +++ b/cstrike/addons/amxmodx/scripting/regg_core.sma @@ -12,7 +12,7 @@ enum _:level_s { WeaponIdType:LevelWeaponID, LevelPoints, LevelTitle[MAX_LEVEL_TITLE_LENGTH], - LevelMod, + LevelRatio, }; enum _:player_s { From f71ebc88a3aa3d1ea64840ff172175af805bccdd Mon Sep 17 00:00:00 2001 From: byjumpe Date: Mon, 18 Dec 2023 20:21:51 +0500 Subject: [PATCH 3/6] New steal mode --- .../addons/amxmodx/configs/regg/regg-main.cfg | 9 +++---- .../addons/amxmodx/scripting/regg/config.inl | 10 +------ .../amxmodx/scripting/regg/functions.inl | 26 ++++++++++++------- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/cstrike/addons/amxmodx/configs/regg/regg-main.cfg b/cstrike/addons/amxmodx/configs/regg/regg-main.cfg index 1487f99..338af2d 100644 --- a/cstrike/addons/amxmodx/configs/regg/regg-main.cfg +++ b/cstrike/addons/amxmodx/configs/regg/regg-main.cfg @@ -6,18 +6,15 @@ regg_mode "0" // Режим Knife Pro позволяет украсть посредством // убийства с ножа уровень либо очки -// Настройка не распространяется на режим командной игры // 0 - отключено -// 1 - кража уровня -// 2 - кража очков +// 1 - кража количества уровней, указанных в настройке regg_steal_value +// 2 - кража количества очков, указанных в настройке regg_steal_value +// 3 - кража количества очков, необходимых для уровня из настроек regg-level.ini (points) regg_steal_mode "1" // Количество украденных очков или уровня (Режим Knife Pro) regg_steal_value "1" -// Количество украденных очков (Knife Pro) в режиме командной игры -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) diff --git a/cstrike/addons/amxmodx/scripting/regg/config.inl b/cstrike/addons/amxmodx/scripting/regg/config.inl index ca8b4be..4361322 100644 --- a/cstrike/addons/amxmodx/scripting/regg/config.inl +++ b/cstrike/addons/amxmodx/scripting/regg/config.inl @@ -9,7 +9,6 @@ enum _:config_s { CfgStealMode, CfgStealValue, - CfgTeamStealValue, CfgAWPOneShot, CfgAmmoAmount, CfgRefillOnKill, @@ -52,13 +51,12 @@ new Config[config_s]; new GameCvars[game_cvars_s]; registerCvars() { - // 0 - off, 1 - steal level, 2 - steal points bind_pcvar_num(create_cvar( "regg_steal_mode", "1", .has_min = true, .min_val = 0.0, .has_max = true, - .max_val = 2.0 + .max_val = 3.0 ), Config[CfgStealMode]); bind_pcvar_num(create_cvar( @@ -67,12 +65,6 @@ registerCvars() { .min_val = 1.0 ), Config[CfgStealValue]); - bind_pcvar_num(create_cvar( - "regg_team_steal_value", "3", - .has_min = true, - .min_val = 1.0 - ), Config[CfgTeamStealValue]); - bind_pcvar_num(create_cvar( "regg_awp_oneshot", "1", .has_min = true, diff --git a/cstrike/addons/amxmodx/scripting/regg/functions.inl b/cstrike/addons/amxmodx/scripting/regg/functions.inl index 9a67dcf..9a4b974 100644 --- a/cstrike/addons/amxmodx/scripting/regg/functions.inl +++ b/cstrike/addons/amxmodx/scripting/regg/functions.inl @@ -232,18 +232,24 @@ bool:suicide(const id) { } ReGG_Result:steal(const killer, const victim) { - if(Mode == ReGG_ModeTeam) { - return stealPoints(killer, victim, Config[CfgTeamStealValue]); - } else { - switch(Config[CfgStealMode]) { - case 1: { - return stealLevels(killer, victim, Config[CfgStealValue]); - } - case 2: { - return stealPoints(killer, victim, Config[CfgStealValue]); + switch(Config[CfgStealMode]) { + case 1: { + return stealLevels(killer, victim, Config[CfgStealValue]); + } + case 2: { + return stealPoints(killer, victim, Config[CfgStealValue]); + } + case 3: { + new level; + if(Mode == ReGG_ModeTeam) { + new slot = getTeamSlot(killer); + level = Teams[slot][TeamLevel]; + } else { + level = Players[killer][PlayerLevel]; } + return stealPoints(killer, victim, Levels[level][LevelPoints]); } - } + } return addPoints(killer, 1); } From 624fe14ec9e2bc4382b7fe4db79acee5f83290ff Mon Sep 17 00:00:00 2001 From: byjumpe Date: Mon, 18 Dec 2023 20:22:39 +0500 Subject: [PATCH 4/6] fix points --- cstrike/addons/amxmodx/scripting/regg/config.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cstrike/addons/amxmodx/scripting/regg/config.inl b/cstrike/addons/amxmodx/scripting/regg/config.inl index 4361322..3510b06 100644 --- a/cstrike/addons/amxmodx/scripting/regg/config.inl +++ b/cstrike/addons/amxmodx/scripting/regg/config.inl @@ -320,7 +320,7 @@ public bool:ConfigOnKeyValue(const INIParser:handle, const key[], const value[]) Levels[LevelsNum][LevelWeaponID] = WeaponIdType:rg_get_weapon_info(value, WI_ID); } else if (strcmp(key, "points") == 0) { Levels[LevelsNum][LevelPoints] = str_to_num(value); - } else if (strcmp(key, "mod") == 0) { + } else if (strcmp(key, "ratio") == 0) { Levels[LevelsNum][LevelRatio] = str_to_num(value); } } From c25d987fcab45a2803aafb89c334a57308c8d271 Mon Sep 17 00:00:00 2001 From: byjumpe Date: Wed, 20 Dec 2023 20:13:29 +0500 Subject: [PATCH 5/6] small fix --- cstrike/addons/amxmodx/scripting/regg/functions.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cstrike/addons/amxmodx/scripting/regg/functions.inl b/cstrike/addons/amxmodx/scripting/regg/functions.inl index 9a4b974..b984e89 100644 --- a/cstrike/addons/amxmodx/scripting/regg/functions.inl +++ b/cstrike/addons/amxmodx/scripting/regg/functions.inl @@ -242,10 +242,10 @@ ReGG_Result:steal(const killer, const victim) { case 3: { new level; if(Mode == ReGG_ModeTeam) { - new slot = getTeamSlot(killer); + new slot = getTeamSlot(victim); level = Teams[slot][TeamLevel]; } else { - level = Players[killer][PlayerLevel]; + level = Players[victim][PlayerLevel]; } return stealPoints(killer, victim, Levels[level][LevelPoints]); } From 4e903c6ac68192bd4f03da72e0c7e5f31f1d60c4 Mon Sep 17 00:00:00 2001 From: byjumpe Date: Wed, 20 Dec 2023 20:29:03 +0500 Subject: [PATCH 6/6] new cvar regg_rolling_points --- cstrike/addons/amxmodx/configs/regg/regg-main.cfg | 9 +++++++++ cstrike/addons/amxmodx/scripting/regg/config.inl | 9 +++++++++ cstrike/addons/amxmodx/scripting/regg/functions.inl | 12 ++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/cstrike/addons/amxmodx/configs/regg/regg-main.cfg b/cstrike/addons/amxmodx/configs/regg/regg-main.cfg index 338af2d..a23a473 100644 --- a/cstrike/addons/amxmodx/configs/regg/regg-main.cfg +++ b/cstrike/addons/amxmodx/configs/regg/regg-main.cfg @@ -15,6 +15,15 @@ regg_steal_mode "1" // Количество украденных очков или уровня (Режим Knife Pro) regg_steal_value "1" +// Очки полученные в ходе убийства с ножа +// при включенном regg_steal_mode, переходят на следующий уровень +// например у вас 3/4, вы украли очки у соперника 3 очка, +// на новом уровне у вас будет 2/4, если отключено 0/4 +// ОТКЛЮЧЕНО НА УРОВНЕ НОЖА И ГРАНАТЫ, ВСЕГДА БУДЕТ ПРИ ПЕРЕХОДЕ 0 +// 0 - отключено +// 1 - включено +regg_rolling_points "1" + // Смена карты, какой плагин использовать // 0 - ReGG Map Manager, a random map from the maplist (maps.ini or mapcycle.txt) // 1 - Map Manager by Mistrik (v. 3.0.7) diff --git a/cstrike/addons/amxmodx/scripting/regg/config.inl b/cstrike/addons/amxmodx/scripting/regg/config.inl index 3510b06..cee2307 100644 --- a/cstrike/addons/amxmodx/scripting/regg/config.inl +++ b/cstrike/addons/amxmodx/scripting/regg/config.inl @@ -9,6 +9,7 @@ enum _:config_s { CfgStealMode, CfgStealValue, + CfgRollingPoints, CfgAWPOneShot, CfgAmmoAmount, CfgRefillOnKill, @@ -65,6 +66,14 @@ registerCvars() { .min_val = 1.0 ), Config[CfgStealValue]); + bind_pcvar_num(create_cvar( + "regg_rolling_points", "1", + .has_min = true, + .min_val = 0.0, + .has_max = true, + .max_val = 1.0 + ), Config[CfgRollingPoints]); + bind_pcvar_num(create_cvar( "regg_awp_oneshot", "1", .has_min = true, diff --git a/cstrike/addons/amxmodx/scripting/regg/functions.inl b/cstrike/addons/amxmodx/scripting/regg/functions.inl index b984e89..c5a4f38 100644 --- a/cstrike/addons/amxmodx/scripting/regg/functions.inl +++ b/cstrike/addons/amxmodx/scripting/regg/functions.inl @@ -354,7 +354,11 @@ ReGG_Result:addPlayerPoints(const id, const value, const bool:forwards = true) { } default: { - points -= needPoints; + if(Config[CfgRollingPoints] > 0) { + points -= needPoints; + } else { + points = 0; + } needPoints = Levels[level][LevelPoints]; result = ReGG_ResultLevelUp; } @@ -400,7 +404,11 @@ ReGG_Result:addTeamPoints(const slot, const value, const bool:forwards = true) { } default: { - points -= needPoints; + if(Config[CfgRollingPoints] > 0) { + points -= needPoints; + } else { + points = 0; + } needPoints = getTeamLevelPoints(slot, level); result = ReGG_ResultLevelUp; }