Skip to content

Commit

Permalink
CSDM Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileYzn committed Jan 10, 2024
1 parent ec43414 commit 0c815d0
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 64 deletions.
15 changes: 12 additions & 3 deletions CSDM/CSDM_Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
Expand Down
71 changes: 31 additions & 40 deletions CSDM/CSDM_Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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<int>((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)
{
Expand All @@ -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);
}
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions CSDM/CSDM_Misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
38 changes: 29 additions & 9 deletions CSDM/CSDM_Weapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion CSDM/CSDM_Weapon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
24 changes: 13 additions & 11 deletions cstrike/addons/csdm/csdm.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -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
Expand All @@ -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
//
Expand All @@ -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 ""
32 changes: 32 additions & 0 deletions cstrike/addons/csdm/spawns/de_freight.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0c815d0

Please sign in to comment.