Skip to content

Commit 0c815d0

Browse files
committed
CSDM Updates
1 parent ec43414 commit 0c815d0

File tree

7 files changed

+119
-64
lines changed

7 files changed

+119
-64
lines changed

CSDM/CSDM_Command.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,25 @@ bool CCSDM_Command::ClientCommand(edict_t* pEntity)
3131
}
3232
}
3333
}
34+
else if (!Q_strcmp(pCmd, "drop"))
35+
{
36+
if (gCSDM_Weapon.SetHideMenu(Player, false))
37+
{
38+
return true;
39+
}
40+
}
3441
else if (!Q_strcmp(pCmd, "say") || !Q_strcmp(pCmd, "say_team"))
3542
{
3643
if (pArg1)
3744
{
3845
if (pArg1[0u] != '\0')
3946
{
40-
if (Q_strstr(pArg1, "/guns") != nullptr)
47+
if (Q_strstr(pArg1, "guns") != nullptr)
4148
{
42-
gCSDM_Weapon.SetHideMenu(Player, false);
43-
return true;
49+
if (gCSDM_Weapon.SetHideMenu(Player, false))
50+
{
51+
return true;
52+
}
4453
}
4554
}
4655
}

CSDM/CSDM_Misc.cpp

Lines changed: 31 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ void CCSDM_Misc::ServerActivate()
1414

1515
this->m_kill_hp_hs = gCSDM_Util.CvarRegister("csdm_kill_hp_hs", "40");
1616

17+
this->m_kill_repair_armor = gCSDM_Util.CvarRegister("csdm_kill_repair_armor", "1");
18+
1719
this->m_kill_msg = gCSDM_Util.CvarRegister("csdm_kill_hp_msg", "1");
1820

1921
this->m_hit_indicator = gCSDM_Util.CvarRegister("csdm_hit_indicator", "0");
@@ -126,64 +128,43 @@ void CCSDM_Misc::PlayerKilled(CBasePlayer* Victim, CBasePlayer* Killer)
126128
{
127129
if (Victim->IsPlayer() && Killer->IsPlayer())
128130
{
131+
auto RestoreHealth = this->m_kill_hp->value;
132+
133+
auto HeadshotCheck = 1.0f;
134+
129135
if (Victim->m_bHeadshotKilled)
130136
{
131137
this->m_Headshots[Killer->entindex()]++;
132138

133-
if (this->m_kill_fade->value == 2.0f)
134-
{
135-
gCSDM_Util.ScreenFade(Killer->edict(), BIT(10), BIT(10), 0x0000, 0, 0, 200, 75);
136-
}
139+
HeadshotCheck = 2.0f;
137140

138-
if (this->m_kill_sound->value == 2.0f)
141+
if (this->m_kill_hp_hs->value > 0.0f)
139142
{
140-
g_engfuncs.pfnClientCommand(Killer->edict(), "%s", "speak \"sound/fvox/blip.wav\"\n");
143+
RestoreHealth = this->m_kill_hp_hs->value;
141144
}
142145
}
143-
else
144-
{
145-
if (this->m_kill_fade->value == 1.0f)
146-
{
147-
gCSDM_Util.ScreenFade(Killer->edict(), BIT(10), BIT(10), 0x0000, 0, 0, 200, 75);
148-
}
149146

150-
if (this->m_kill_sound->value == 1.0f)
151-
{
152-
g_engfuncs.pfnClientCommand(Killer->edict(), "%s", "speak \"sound/fvox/blip.wav\"\n");
153-
}
147+
if (RestoreHealth > 0.0f)
148+
{
149+
Killer->edict()->v.health = clamp(Killer->edict()->v.health + RestoreHealth, 1.0f, 100.0f);
154150
}
155151

156-
if (this->m_kill_hp->value > 0.0f || this->m_kill_hp_hs->value > 0.0f)
152+
if (this->m_kill_repair_armor->value == HeadshotCheck)
157153
{
158-
if (Killer->edict()->v.health < 100.0f)
159-
{
160-
auto Health = clamp(this->m_kill_hp->value, 1.0f, 100.0f);
161-
162-
if (Victim->m_bHeadshotKilled)
163-
{
164-
if (this->m_kill_hp_hs->value > 0.0f)
165-
{
166-
Health = clamp(this->m_kill_hp_hs->value, 1.0f, 100.0f);
167-
}
168-
}
169-
170-
Killer->edict()->v.health = clamp(Killer->edict()->v.health + Health, 1.0f, 100.0f);
171-
172-
Killer->edict()->v.armorvalue = 100.0f;
173-
}
154+
Killer->edict()->v.armorvalue = 100.0f;
174155
}
175156

176-
if (this->m_kill_msg->value)
157+
if (this->m_kill_fade->value == HeadshotCheck)
177158
{
178-
auto Value = static_cast<int>((Killer->edict()->v.health - Killer->m_iLastClientHealth));
159+
gCSDM_Util.ScreenFade(Killer->edict(), BIT(10), BIT(10), 0x0000, 0, 0, 200, 75);
160+
}
179161

180-
if (Value > 0)
181-
{
182-
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);
183-
}
162+
if (this->m_kill_sound->value == HeadshotCheck)
163+
{
164+
g_engfuncs.pfnClientCommand(Killer->edict(), "%s", "speak \"sound/fvox/blip.wav\"\n");
184165
}
185166

186-
if (this->m_reload_on_kill->value > 0.0f)
167+
if (this->m_reload_on_kill->value == HeadshotCheck)
187168
{
188169
if (Killer->m_pActiveItem)
189170
{
@@ -193,6 +174,16 @@ void CCSDM_Misc::PlayerKilled(CBasePlayer* Victim, CBasePlayer* Killer)
193174
}
194175
}
195176
}
177+
178+
if (this->m_kill_msg->value)
179+
{
180+
auto Value = (int)(Killer->edict()->v.health - (float)(Killer->m_iLastClientHealth));
181+
182+
if (Value > 0)
183+
{
184+
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);
185+
}
186+
}
196187
}
197188
}
198189
}

CSDM/CSDM_Misc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class CCSDM_Misc
4444
cvar_t* m_kill_sound;
4545
cvar_t* m_kill_hp;
4646
cvar_t* m_kill_hp_hs;
47+
cvar_t* m_kill_repair_armor;
4748
cvar_t* m_kill_msg;
4849
cvar_t* m_hit_indicator;
4950
cvar_t* m_hide_kill_feed;

CSDM/CSDM_Weapon.cpp

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ void CCSDM_Weapon::CBasePlayer_SetAnimation(IReGameHook_CBasePlayer_SetAnimation
132132
void CCSDM_Weapon::ResetPlayer(CBasePlayer* Player)
133133
{
134134
this->m_Info[Player->entindex()].Reset();
135+
136+
if (!Player->IsBot())
137+
{
138+
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.");
139+
}
135140
}
136141

137142
void CCSDM_Weapon::EquipItem(CBasePlayer* Player, InventorySlotType SlotType, std::string Item)
@@ -225,21 +230,36 @@ bool CCSDM_Weapon::EquipLast(CBasePlayer* Player)
225230
return Result;
226231
}
227232

228-
void CCSDM_Weapon::SetHideMenu(CBasePlayer* Player, bool HideMenu)
233+
bool CCSDM_Weapon::SetHideMenu(CBasePlayer* Player, bool HideMenu)
229234
{
230235
if (Player)
231236
{
232-
if (HideMenu)
233-
{
234-
gCSDM_Util.SayText(Player->edict(), PRINT_TEAM_RED, "Type ^4'/guns'^1 in chat to re-enable your equip menu.");
235-
}
236-
else
237+
if (this->m_Enabled)
237238
{
238-
gCSDM_Util.SayText(Player->edict(), PRINT_TEAM_BLUE, "Your equip menu has been re-enabled.");
239-
}
239+
auto EntityIndex = Player->entindex();
240+
241+
if (HideMenu)
242+
{
243+
if (!this->m_Info[EntityIndex].HideMenu)
244+
{
245+
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.");
246+
}
247+
}
248+
else
249+
{
250+
if (this->m_Info[EntityIndex].HideMenu)
251+
{
252+
gCSDM_Util.SayText(Player->edict(), PRINT_TEAM_DEFAULT, "Your equip menu has been re-enabled.");
253+
}
254+
}
255+
256+
this->m_Info[EntityIndex].HideMenu = HideMenu;
240257

241-
this->m_Info[Player->entindex()].HideMenu = HideMenu;
258+
return true;
259+
}
242260
}
261+
262+
return false;
243263
}
244264

245265
bool CCSDM_Weapon::GetHideMenu(int EntityIndex)

CSDM/CSDM_Weapon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class CCSDM_Weapon
4343
void EquipRandom(CBasePlayer* Player, int Slot);
4444
bool EquipLast(CBasePlayer* Player);
4545

46-
void SetHideMenu(CBasePlayer* Player, bool HideMenu);
46+
bool SetHideMenu(CBasePlayer* Player, bool HideMenu);
4747
bool GetHideMenu(int EntityIndex);
4848

4949
void SetWeaponState(int EntityIndex, CBasePlayerWeapon* Weapon);

cstrike/addons/csdm/csdm.cfg

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ csdm_hide_kill_feed "0"
2323
// 4 Show hitbox (Head, Chest, Stomach etc.)
2424
//
2525
// Defaut "0"
26-
csdm_hit_indicator "0"
26+
csdm_hit_indicator "4"
2727

2828
// Only accept hits at head on players
2929
//
@@ -65,6 +65,15 @@ csdm_kill_hp "15"
6565
// Defaut "40"
6666
csdm_kill_hp_hs "40"
6767

68+
// Armor restore after a kill
69+
//
70+
// 0 Disable
71+
// 1 Enable
72+
// 2 Headshot only
73+
//
74+
// Defaut "1"
75+
csdm_kill_repair_armor "1"
76+
6877
// Display amount of health healed after a kill
6978
//
7079
// 0 Disable
@@ -80,7 +89,7 @@ csdm_kill_hp_msg "1"
8089
// 2 For headshots only
8190
//
8291
// Defaut "0"
83-
csdm_kill_sound "0"
92+
csdm_kill_sound "2"
8493

8594
// Show frags number in money
8695
//
@@ -90,17 +99,10 @@ csdm_kill_sound "0"
9099
// Defaut "0"
91100
csdm_money_as_frags "0"
92101

93-
// Automatically reload weapon after kill
94-
//
95-
// 0 Disable
96-
// 1 Enable
97-
//
98-
// Defaut "0"
99-
csdm_reload_on_kill "0"
100-
101-
// CSDM Spawn Editor access
102+
// CSDM spawn editor access
102103
//
103104
// Put here who is allowed to edit spawns
105+
// Admin must use 'csdm_edit_spawns' command
104106
//
105107
// Defaut ""
106108
csdm_spawn_edit_admin ""
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
-102 -2200 51 0 -42 0 0 1 -42 0
2+
807 -2141 -4 0 -61 0 0 0 -61 0
3+
517 -2403 51 0 150 0 0 0 150 0
4+
-101 -2666 51 0 28 0 0 0 28 0
5+
-487 -1609 131 -1 139 0 0 3 139 0
6+
-225 -1739 -12 0 18 0 0 -2 18 0
7+
-372 -989 -12 0 -48 0 0 1 -48 0
8+
-1285 -1684 -12 -1 49 0 0 3 49 0
9+
-1027 -951 -12 0 -31 0 0 -1 -31 0
10+
-797 -615 -12 -1 52 0 0 3 52 0
11+
-422 -876 147 -3 157 0 0 10 157 0
12+
-358 -695 -12 0 -38 0 0 1 -38 0
13+
353 -1002 -12 1 16 0 0 -4 16 0
14+
857 -1484 -12 0 21 0 0 1 21 0
15+
1401 -1944 27 -1 130 0 0 3 130 0
16+
1995 -1097 32 0 117 0 0 0 117 0
17+
1614 -1802 3 0 19 0 0 1 19 0
18+
1698 -1497 -12 0 136 0 0 1 136 0
19+
1192 -1006 51 0 146 0 0 2 146 0
20+
854 -567 51 0 -52 0 0 0 -52 0
21+
-490 -307 3 -1 -33 0 0 4 -33 0
22+
-73 -699 -12 0 32 0 0 0 32 0
23+
393 -619 -12 0 141 0 0 0 141 0
24+
1251 -306 51 0 -170 0 0 1 -170 0
25+
644 126 51 -2 -125 0 0 8 -125 0
26+
225 548 147 -1 -138 0 0 3 -138 0
27+
-222 31 115 0 42 0 0 2 42 0
28+
-736 208 115 0 -8 0 0 1 -8 0
29+
-682 -339 131 -1 41 0 0 5 41 0
30+
-578 -1437 11 0 134 0 0 2 134 0
31+
-1314 -1244 -12 0 -62 0 0 1 -62 0
32+
-222 536 147 -1 -49 0 0 3 -49 0

0 commit comments

Comments
 (0)