Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
marqdevx committed Apr 23, 2024
1 parent 72636d0 commit a270d4b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
4 changes: 2 additions & 2 deletions CFGs/scrim.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ mp_autokick 0
mp_match_can_clinch 0

mp_freezetime 20
mp_warmup_end
mp_restartgame 1

cash_team_bonus_shorthanded 0
contributionscore_suicide -3
mp_restartgame 1

say "Competitive MR24 loaded"
say "by ρλd"
4 changes: 3 additions & 1 deletion CFGs/unpracc.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
sv_cheats 0

bot_kick
mp_warmup_end

bot_quota 0
bot_kick

sv_grenade_trajectory 0
sv_infinite_ammo 0
Expand Down
26 changes: 15 additions & 11 deletions src/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bool damagePrint_shown = false;
bool g_bEnableDamagePrint = true;
FAKE_BOOL_CVAR(cs2scrim_damage_print, "Whether to enable chat Damage Print", g_bEnableDamagePrint, true, false)

void PrintDamageInfo(int client) {
static void PrintDamageInfo(int client) {
CCSPlayerController* pController = CCSPlayerController::FromSlot(client);

if(!pController)
Expand All @@ -73,7 +73,7 @@ void PrintDamageInfo(int client) {
int targetHealth = pTarget->GetPawn()->m_iHealth();
if (targetHealth < 0) targetHealth = 0;

ClientPrint(pController, HUD_PRINTTALK, CHAT_PREFIX "(%i dmg / %i hits) to (%i dmg / %i hits) from %s (%i)", g_DamageDone[client][i], g_DamageDoneHits[client][i], g_DamageDone[i][client], g_DamageDoneHits[i][client], pTarget->GetPlayerName(), targetHealth);
ClientPrint(pController, HUD_PRINTTALK, CHAT_PREFIX "(%i dmg / %i hits) to (%i dmg / %i hits) from %i (%i)", g_DamageDone[client][i], g_DamageDoneHits[client][i], g_DamageDone[i][client], g_DamageDoneHits[i][client], i, targetHealth);
}
}
}
Expand Down Expand Up @@ -189,7 +189,8 @@ GAME_EVENT_F(round_prestart)

GAME_EVENT_F(round_start)
{
if (g_bEnableDamagePrint && damagePrint_shown){
if (g_bEnableDamagePrint){

for (int i = 1; i <= gpGlobals->maxClients; i++) {
for (int j = 1; j <= gpGlobals->maxClients; j++) {
g_DamageDone[i][j] = 0;
Expand Down Expand Up @@ -266,12 +267,16 @@ GAME_EVENT_F(player_hurt){
CCSPlayerController* pVictim = (CCSPlayerController *)g_pEntitySystem->GetBaseEntity((CEntityIndex)(pEvent->GetUint64("userid") + 1));
CCSPlayerController* pAttacker = (CCSPlayerController *)g_pEntitySystem->GetBaseEntity((CEntityIndex)(pEvent->GetUint64("attacker") + 1));

if(!pVictim || !pAttacker) return;
if(!pVictim || !pAttacker)
return;

int damage = pEvent->GetFloat("dmg_health");
int damage = pEvent->GetInt("dmg_health");
int postDamageHealth = pEvent->GetFloat("health");
int preDamageHealth = pVictim->GetPawn()->m_iHealth();

const char * victimName = pVictim->GetPlayerName();
if(!pVictim->GetPlayerName()) victimName = "Unknown";

if(g_bEnableDamagePrint && !practiceMode){
int attacker = pEvent->GetFloat("attacker");
int victim = pEvent->GetFloat("userid");
Expand All @@ -287,10 +292,11 @@ GAME_EVENT_F(player_hurt){
g_DamageDoneHits[attacker][victim]++;
return;
}

if(!practiceMode || !g_bEnablePractice) return;
ClientPrint(pAttacker, HUD_PRINTTALK, CHAT_PREFIX "Damage done \04%d \01to \04%s\1[\04%d\01]", damage, victimName, postDamageHealth);
if(!practiceMode || !g_bEnablePractice)
return;

ClientPrint(pAttacker, HUD_PRINTTALK, CHAT_PREFIX "Damage done \04%d \01to \04%s\1[\04%d\01]", damage , pVictim->GetPlayerName(), postDamageHealth);
ClientPrint(pAttacker, HUD_PRINTTALK, CHAT_PREFIX "Damage done \04%d \01to \04%s\1[\04%d\01]", damage, victimName, postDamageHealth);
}

GAME_EVENT_F(player_blind){
Expand Down Expand Up @@ -346,14 +352,12 @@ GAME_EVENT_F(round_end){
if(!g_bEnableDamagePrint || practiceMode)
return;

for (int i = 1; i <= gpGlobals->maxClients; i++) {
for (int i = 0; i <= gpGlobals->maxClients; i++) {
CCSPlayerController* pController = CCSPlayerController::FromSlot(i);

if(!pController)
continue;

PrintDamageInfo(i);
}

damagePrint_shown = true;
}

0 comments on commit a270d4b

Please sign in to comment.