From 0c815d0fcac1f4579e7497f76f975651fa546065 Mon Sep 17 00:00:00 2001 From: SmileY Date: Wed, 10 Jan 2024 01:04:18 -0300 Subject: [PATCH] CSDM Updates --- CSDM/CSDM_Command.cpp | 15 ++++- CSDM/CSDM_Misc.cpp | 71 ++++++++++------------- CSDM/CSDM_Misc.h | 1 + CSDM/CSDM_Weapon.cpp | 38 +++++++++--- CSDM/CSDM_Weapon.h | 2 +- cstrike/addons/csdm/csdm.cfg | 24 ++++---- cstrike/addons/csdm/spawns/de_freight.txt | 32 ++++++++++ 7 files changed, 119 insertions(+), 64 deletions(-) create mode 100644 cstrike/addons/csdm/spawns/de_freight.txt diff --git a/CSDM/CSDM_Command.cpp b/CSDM/CSDM_Command.cpp index cdd5c59..4ca8c70 100644 --- a/CSDM/CSDM_Command.cpp +++ b/CSDM/CSDM_Command.cpp @@ -31,16 +31,25 @@ bool CCSDM_Command::ClientCommand(edict_t* pEntity) } } } + else if (!Q_strcmp(pCmd, "drop")) + { + if (gCSDM_Weapon.SetHideMenu(Player, false)) + { + return true; + } + } else if (!Q_strcmp(pCmd, "say") || !Q_strcmp(pCmd, "say_team")) { if (pArg1) { if (pArg1[0u] != '\0') { - if (Q_strstr(pArg1, "/guns") != nullptr) + if (Q_strstr(pArg1, "guns") != nullptr) { - gCSDM_Weapon.SetHideMenu(Player, false); - return true; + if (gCSDM_Weapon.SetHideMenu(Player, false)) + { + return true; + } } } } diff --git a/CSDM/CSDM_Misc.cpp b/CSDM/CSDM_Misc.cpp index b292140..f034d3f 100644 --- a/CSDM/CSDM_Misc.cpp +++ b/CSDM/CSDM_Misc.cpp @@ -14,6 +14,8 @@ void CCSDM_Misc::ServerActivate() this->m_kill_hp_hs = gCSDM_Util.CvarRegister("csdm_kill_hp_hs", "40"); + this->m_kill_repair_armor = gCSDM_Util.CvarRegister("csdm_kill_repair_armor", "1"); + this->m_kill_msg = gCSDM_Util.CvarRegister("csdm_kill_hp_msg", "1"); this->m_hit_indicator = gCSDM_Util.CvarRegister("csdm_hit_indicator", "0"); @@ -126,64 +128,43 @@ void CCSDM_Misc::PlayerKilled(CBasePlayer* Victim, CBasePlayer* Killer) { if (Victim->IsPlayer() && Killer->IsPlayer()) { + auto RestoreHealth = this->m_kill_hp->value; + + auto HeadshotCheck = 1.0f; + if (Victim->m_bHeadshotKilled) { this->m_Headshots[Killer->entindex()]++; - if (this->m_kill_fade->value == 2.0f) - { - gCSDM_Util.ScreenFade(Killer->edict(), BIT(10), BIT(10), 0x0000, 0, 0, 200, 75); - } + HeadshotCheck = 2.0f; - if (this->m_kill_sound->value == 2.0f) + if (this->m_kill_hp_hs->value > 0.0f) { - g_engfuncs.pfnClientCommand(Killer->edict(), "%s", "speak \"sound/fvox/blip.wav\"\n"); + RestoreHealth = this->m_kill_hp_hs->value; } } - else - { - if (this->m_kill_fade->value == 1.0f) - { - gCSDM_Util.ScreenFade(Killer->edict(), BIT(10), BIT(10), 0x0000, 0, 0, 200, 75); - } - if (this->m_kill_sound->value == 1.0f) - { - g_engfuncs.pfnClientCommand(Killer->edict(), "%s", "speak \"sound/fvox/blip.wav\"\n"); - } + if (RestoreHealth > 0.0f) + { + Killer->edict()->v.health = clamp(Killer->edict()->v.health + RestoreHealth, 1.0f, 100.0f); } - if (this->m_kill_hp->value > 0.0f || this->m_kill_hp_hs->value > 0.0f) + if (this->m_kill_repair_armor->value == HeadshotCheck) { - if (Killer->edict()->v.health < 100.0f) - { - auto Health = clamp(this->m_kill_hp->value, 1.0f, 100.0f); - - if (Victim->m_bHeadshotKilled) - { - if (this->m_kill_hp_hs->value > 0.0f) - { - Health = clamp(this->m_kill_hp_hs->value, 1.0f, 100.0f); - } - } - - Killer->edict()->v.health = clamp(Killer->edict()->v.health + Health, 1.0f, 100.0f); - - Killer->edict()->v.armorvalue = 100.0f; - } + Killer->edict()->v.armorvalue = 100.0f; } - if (this->m_kill_msg->value) + if (this->m_kill_fade->value == HeadshotCheck) { - auto Value = static_cast((Killer->edict()->v.health - Killer->m_iLastClientHealth)); + gCSDM_Util.ScreenFade(Killer->edict(), BIT(10), BIT(10), 0x0000, 0, 0, 200, 75); + } - if (Value > 0) - { - gCSDM_Util.ShowHudMessage(Killer->edict(), gCSDM_Util.SetHudParam(0, 255, 0, -1.0f, 0.8f, 0, 1.0f, 1.0f, 0.0f, 0.0f, 1), "+%d HP", Value); - } + if (this->m_kill_sound->value == HeadshotCheck) + { + g_engfuncs.pfnClientCommand(Killer->edict(), "%s", "speak \"sound/fvox/blip.wav\"\n"); } - if (this->m_reload_on_kill->value > 0.0f) + if (this->m_reload_on_kill->value == HeadshotCheck) { if (Killer->m_pActiveItem) { @@ -193,6 +174,16 @@ void CCSDM_Misc::PlayerKilled(CBasePlayer* Victim, CBasePlayer* Killer) } } } + + if (this->m_kill_msg->value) + { + auto Value = (int)(Killer->edict()->v.health - (float)(Killer->m_iLastClientHealth)); + + if (Value > 0) + { + gCSDM_Util.ShowHudMessage(Killer->edict(), gCSDM_Util.SetHudParam(0, 255, 0, -1.0f, 0.8f, 0, 1.0f, 1.0f, 0.0f, 0.0f, 1), "+%d HP", Value); + } + } } } } diff --git a/CSDM/CSDM_Misc.h b/CSDM/CSDM_Misc.h index 68949e3..c3a811b 100644 --- a/CSDM/CSDM_Misc.h +++ b/CSDM/CSDM_Misc.h @@ -44,6 +44,7 @@ class CCSDM_Misc cvar_t* m_kill_sound; cvar_t* m_kill_hp; cvar_t* m_kill_hp_hs; + cvar_t* m_kill_repair_armor; cvar_t* m_kill_msg; cvar_t* m_hit_indicator; cvar_t* m_hide_kill_feed; diff --git a/CSDM/CSDM_Weapon.cpp b/CSDM/CSDM_Weapon.cpp index b465750..fa51185 100644 --- a/CSDM/CSDM_Weapon.cpp +++ b/CSDM/CSDM_Weapon.cpp @@ -132,6 +132,11 @@ void CCSDM_Weapon::CBasePlayer_SetAnimation(IReGameHook_CBasePlayer_SetAnimation void CCSDM_Weapon::ResetPlayer(CBasePlayer* Player) { this->m_Info[Player->entindex()].Reset(); + + if (!Player->IsBot()) + { + gCSDM_Util.SayText(Player->edict(), PRINT_TEAM_DEFAULT, "Press ^3'G'^1 or type ^3'guns'^1 in chat to re-enable your equip menu."); + } } void CCSDM_Weapon::EquipItem(CBasePlayer* Player, InventorySlotType SlotType, std::string Item) @@ -225,21 +230,36 @@ bool CCSDM_Weapon::EquipLast(CBasePlayer* Player) return Result; } -void CCSDM_Weapon::SetHideMenu(CBasePlayer* Player, bool HideMenu) +bool CCSDM_Weapon::SetHideMenu(CBasePlayer* Player, bool HideMenu) { if (Player) { - if (HideMenu) - { - gCSDM_Util.SayText(Player->edict(), PRINT_TEAM_RED, "Type ^4'/guns'^1 in chat to re-enable your equip menu."); - } - else + if (this->m_Enabled) { - gCSDM_Util.SayText(Player->edict(), PRINT_TEAM_BLUE, "Your equip menu has been re-enabled."); - } + auto EntityIndex = Player->entindex(); + + if (HideMenu) + { + if (!this->m_Info[EntityIndex].HideMenu) + { + gCSDM_Util.SayText(Player->edict(), PRINT_TEAM_DEFAULT, "Press ^3'G'^1 or type ^3'guns'^1 in chat to re-enable your equip menu."); + } + } + else + { + if (this->m_Info[EntityIndex].HideMenu) + { + gCSDM_Util.SayText(Player->edict(), PRINT_TEAM_DEFAULT, "Your equip menu has been re-enabled."); + } + } + + this->m_Info[EntityIndex].HideMenu = HideMenu; - this->m_Info[Player->entindex()].HideMenu = HideMenu; + return true; + } } + + return false; } bool CCSDM_Weapon::GetHideMenu(int EntityIndex) diff --git a/CSDM/CSDM_Weapon.h b/CSDM/CSDM_Weapon.h index 533d064..7c309c3 100644 --- a/CSDM/CSDM_Weapon.h +++ b/CSDM/CSDM_Weapon.h @@ -43,7 +43,7 @@ class CCSDM_Weapon void EquipRandom(CBasePlayer* Player, int Slot); bool EquipLast(CBasePlayer* Player); - void SetHideMenu(CBasePlayer* Player, bool HideMenu); + bool SetHideMenu(CBasePlayer* Player, bool HideMenu); bool GetHideMenu(int EntityIndex); void SetWeaponState(int EntityIndex, CBasePlayerWeapon* Weapon); diff --git a/cstrike/addons/csdm/csdm.cfg b/cstrike/addons/csdm/csdm.cfg index 61732a2..26d6e17 100644 --- a/cstrike/addons/csdm/csdm.cfg +++ b/cstrike/addons/csdm/csdm.cfg @@ -23,7 +23,7 @@ csdm_hide_kill_feed "0" // 4 Show hitbox (Head, Chest, Stomach etc.) // // Defaut "0" -csdm_hit_indicator "0" +csdm_hit_indicator "4" // Only accept hits at head on players // @@ -65,6 +65,15 @@ csdm_kill_hp "15" // Defaut "40" csdm_kill_hp_hs "40" +// Armor restore after a kill +// +// 0 Disable +// 1 Enable +// 2 Headshot only +// +// Defaut "1" +csdm_kill_repair_armor "1" + // Display amount of health healed after a kill // // 0 Disable @@ -80,7 +89,7 @@ csdm_kill_hp_msg "1" // 2 For headshots only // // Defaut "0" -csdm_kill_sound "0" +csdm_kill_sound "2" // Show frags number in money // @@ -90,17 +99,10 @@ csdm_kill_sound "0" // Defaut "0" csdm_money_as_frags "0" -// Automatically reload weapon after kill -// -// 0 Disable -// 1 Enable -// -// Defaut "0" -csdm_reload_on_kill "0" - -// CSDM Spawn Editor access +// CSDM spawn editor access // // Put here who is allowed to edit spawns +// Admin must use 'csdm_edit_spawns' command // // Defaut "" csdm_spawn_edit_admin "" \ No newline at end of file diff --git a/cstrike/addons/csdm/spawns/de_freight.txt b/cstrike/addons/csdm/spawns/de_freight.txt new file mode 100644 index 0000000..95a0080 --- /dev/null +++ b/cstrike/addons/csdm/spawns/de_freight.txt @@ -0,0 +1,32 @@ +-102 -2200 51 0 -42 0 0 1 -42 0 +807 -2141 -4 0 -61 0 0 0 -61 0 +517 -2403 51 0 150 0 0 0 150 0 +-101 -2666 51 0 28 0 0 0 28 0 +-487 -1609 131 -1 139 0 0 3 139 0 +-225 -1739 -12 0 18 0 0 -2 18 0 +-372 -989 -12 0 -48 0 0 1 -48 0 +-1285 -1684 -12 -1 49 0 0 3 49 0 +-1027 -951 -12 0 -31 0 0 -1 -31 0 +-797 -615 -12 -1 52 0 0 3 52 0 +-422 -876 147 -3 157 0 0 10 157 0 +-358 -695 -12 0 -38 0 0 1 -38 0 +353 -1002 -12 1 16 0 0 -4 16 0 +857 -1484 -12 0 21 0 0 1 21 0 +1401 -1944 27 -1 130 0 0 3 130 0 +1995 -1097 32 0 117 0 0 0 117 0 +1614 -1802 3 0 19 0 0 1 19 0 +1698 -1497 -12 0 136 0 0 1 136 0 +1192 -1006 51 0 146 0 0 2 146 0 +854 -567 51 0 -52 0 0 0 -52 0 +-490 -307 3 -1 -33 0 0 4 -33 0 +-73 -699 -12 0 32 0 0 0 32 0 +393 -619 -12 0 141 0 0 0 141 0 +1251 -306 51 0 -170 0 0 1 -170 0 +644 126 51 -2 -125 0 0 8 -125 0 +225 548 147 -1 -138 0 0 3 -138 0 +-222 31 115 0 42 0 0 2 42 0 +-736 208 115 0 -8 0 0 1 -8 0 +-682 -339 131 -1 41 0 0 5 41 0 +-578 -1437 11 0 134 0 0 2 134 0 +-1314 -1244 -12 0 -62 0 0 1 -62 0 +-222 536 147 -1 -49 0 0 3 -49 0