diff --git a/cstrike/addons/amxmodx/configs/csdm/config.ini b/cstrike/addons/amxmodx/configs/csdm/config.ini index 67dcba8..bd2268e 100644 --- a/cstrike/addons/amxmodx/configs/csdm/config.ini +++ b/cstrike/addons/amxmodx/configs/csdm/config.ini @@ -40,6 +40,9 @@ refill_clip_weapons = 1 ; t - timer hide_hud_flags = "ft" +; Allow reset score for players by chat cmd '/rs'. +allow_reset_score = 1 + [protection] ; Number of seconds someone is respawned for. ; 0 = disable diff --git a/cstrike/addons/amxmodx/configs/csdm/extraconfigs/_de_dust2.ini b/cstrike/addons/amxmodx/configs/csdm/extraconfigs/_de_dust2.ini index bc55d0d..bd2268e 100644 --- a/cstrike/addons/amxmodx/configs/csdm/extraconfigs/_de_dust2.ini +++ b/cstrike/addons/amxmodx/configs/csdm/extraconfigs/_de_dust2.ini @@ -40,12 +40,14 @@ refill_clip_weapons = 1 ; t - timer hide_hud_flags = "ft" +; Allow reset score for players by chat cmd '/rs'. +allow_reset_score = 1 + [protection] ; Number of seconds someone is respawned for. ; 0 = disable protection_time = 2.0 - ; Colors of glow shell, leave this in quotes ; The digits are "R G B" ; random value "random" @@ -78,7 +80,7 @@ exclude_bomb = 0 ; 1 - equip menu ([secondary] & [primary] + [autoitems]) ; 2 - randomly weapons ([secondary] & [primary] + [autoitems]) ; 3 - free buy (only buying) -equip_mode = 3 +equip_mode = 1 ; Free buy time in seconds (weapon buy flood protect!) ; 0 - no time limit diff --git a/cstrike/addons/amxmodx/configs/csdm/extraconfigs/_prefix_de.ini b/cstrike/addons/amxmodx/configs/csdm/extraconfigs/_prefix_de.ini index 2b3df60..bd2268e 100644 --- a/cstrike/addons/amxmodx/configs/csdm/extraconfigs/_prefix_de.ini +++ b/cstrike/addons/amxmodx/configs/csdm/extraconfigs/_prefix_de.ini @@ -40,6 +40,9 @@ refill_clip_weapons = 1 ; t - timer hide_hud_flags = "ft" +; Allow reset score for players by chat cmd '/rs'. +allow_reset_score = 1 + [protection] ; Number of seconds someone is respawned for. ; 0 = disable @@ -77,7 +80,7 @@ exclude_bomb = 0 ; 1 - equip menu ([secondary] & [primary] + [autoitems]) ; 2 - randomly weapons ([secondary] & [primary] + [autoitems]) ; 3 - free buy (only buying) -equip_mode = 3 +equip_mode = 1 ; Free buy time in seconds (weapon buy flood protect!) ; 0 - no time limit diff --git a/cstrike/addons/amxmodx/data/lang/csdm_reapi.txt b/cstrike/addons/amxmodx/data/lang/csdm_reapi.txt index 7fef72e..ec8308e 100644 --- a/cstrike/addons/amxmodx/data/lang/csdm_reapi.txt +++ b/cstrike/addons/amxmodx/data/lang/csdm_reapi.txt @@ -10,6 +10,7 @@ PRIMARY_WEAPONS = Primary weapon CHAT_HELP_GUNS = ^3say ^1guns ^3to re-enable the gun menu. MENU_WILL_BE_OPENED = ^3Gun menu will be re-enabled next spawn. FREEBUYTIME_PASSED = %0.f seconds have passed. ^rYou can't buy anything now! +CHAT_RESETSCORE = Your score has been reset! [ru] EQUIP_MENU = Меню вооружения @@ -23,3 +24,4 @@ PRIMARY_WEAPONS = Основное оружие CHAT_HELP_GUNS = ^3напишите ^1guns ^3, чтобы открыть меню оружия. MENU_WILL_BE_OPENED = ^3Меню вооружения будет открыто при следующем возрождении. FREEBUYTIME_PASSED = %0.f секунд прошло. ^rВы не можете больше покупать! +CHAT_RESETSCORE = Ваш счёт был сброшен! diff --git a/cstrike/addons/amxmodx/scripting/CSDM_ReAPI/csdm_misc.sma b/cstrike/addons/amxmodx/scripting/CSDM_ReAPI/csdm_misc.sma index f7071cc..2c484a3 100644 --- a/cstrike/addons/amxmodx/scripting/CSDM_ReAPI/csdm_misc.sma +++ b/cstrike/addons/amxmodx/scripting/CSDM_ReAPI/csdm_misc.sma @@ -19,8 +19,23 @@ new HamHook:g_hSecondaryAttack[sizeof(g_szWeaponList)], HamHook:g_hAddToPlayer[s new g_bWeaponState[MAX_CLIENTS + 1][CSW_P90 + 1] -new bool:g_bWeaponStateRemember = true, g_bitHideHudFlags, g_iRefillClip = 1 +new bool:g_bWeaponStateRemember = true, g_bitHideHudFlags, g_iRefillClip = 1, bool:g_bAllowResetScore = true +#define register_trigger_clcmd(%0,%1) \ + for (new iter = 0; iter < sizeof(BASE_CHAT_TRIGGERS); iter++) \ + { \ + register_clcmd(fmt("say %s%s", BASE_CHAT_TRIGGERS[iter], %0), %1); \ + register_clcmd(fmt("say_team %s%s", BASE_CHAT_TRIGGERS[iter], %0), %1); \ + } + +new stock const BASE_CHAT_TRIGGERS[][] = { "/", "\", "!", "." }; + +enum forwardlist_e +{ + iFwdPlayerResetScore +} + +new g_eCustomForwards[forwardlist_e] public plugin_init() { @@ -31,6 +46,13 @@ public plugin_init() DisableHamForward(g_hAddToPlayer[i] = RegisterHam(Ham_Item_AddToPlayer, g_szWeaponList[i], "CBasePlayerItem_AddToPlayer", .Post = true)) DisableHamForward(g_hSecondaryAttack[i] = RegisterHam(Ham_Weapon_SecondaryAttack, g_szWeaponList[i], "CBasePlayerItem_SecAttack", .Post = true)) } + + new const CMDS_ResetScore[][] = { "rs", "resetscore" }; + for(new i; i < sizeof(CMDS_ResetScore); i++) { + register_trigger_clcmd(CMDS_ResetScore[i], "hCMD_ResetScore") + } + + g_eCustomForwards[iFwdPlayerResetScore] = CreateMultiForward("CSDM_PlayerResetScore", ET_IGNORE, FP_CELL) } public plugin_cfg() @@ -132,6 +154,10 @@ public ReadCfg(const szLineData[], const iSectionID) if(ContainFlag(szValue, "t")) g_bitHideHudFlags |= HIDEHUD_TIMER } + else if(equali(szKey, "allow_reset_score")) + { + g_bAllowResetScore = true; + } } CheckForwards() @@ -165,3 +191,24 @@ CheckForwards() iMsgHookHideWeapon = 0 } } + +public hCMD_ResetScore(const pPlayer) { + if(!g_bAllowResetScore) + return PLUGIN_CONTINUE + + if(is_nullent(pPlayer)) + return PLUGIN_CONTINUE + + new ret; + ExecuteForward(g_eCustomForwards[iFwdPlayerResetScore], ret, pPlayer) + + if(ret == PLUGIN_HANDLED) + return PLUGIN_CONTINUE + + set_entvar(pPlayer, var_frags, 0.0) + set_member(pPlayer, m_iDeaths, 0) + + client_print_color(pPlayer, print_team_grey, "^4[CSDM] %L", pPlayer, "CHAT_RESETSCORE") + + return PLUGIN_HANDLED +} diff --git a/cstrike/addons/amxmodx/scripting/include/csdm.inc b/cstrike/addons/amxmodx/scripting/include/csdm.inc index 32cc28a..e290d6c 100644 --- a/cstrike/addons/amxmodx/scripting/include/csdm.inc +++ b/cstrike/addons/amxmodx/scripting/include/csdm.inc @@ -132,6 +132,14 @@ forward CSDM_PlayerSpawned(const pPlayer, const bool:bIsBot, const iNumSpawns) */ forward CSDM_PlayerKilled(const pVictim, const pKiller, const HitBoxGroup:iLastHitGroup) +/** Player reset score. +* +* @param pPlayer Player id +* +* @note return PLUGIN_HANDLED will block change +*/ +forward CSDM_PlayerResetScore(const pPlayer) + //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ NATIVES ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■