Raised This Month: $51 Target: $400
 12% 

Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)


Post New Thread Reply   
 
Thread Tools Display Modes
mglstew
New Member
Join Date: Apr 2020
Old 04-13-2020 , 21:58   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #21

Quote:
Originally Posted by Addicted. View Post
Change:
#include "include/common.inc"
#include "include/csgo_common.inc"

To:
#include <common>
#include <csgo_common>
It still says /groups/sourcemod/upload_tmp/textQxrmPW.sp(4) : fatal error 183: cannot read from file: "common". I don't know what to do now. Help me
mglstew is offline
luciusxsein
New Member
Join Date: Jul 2020
Old 07-01-2020 , 22:14   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #22

Quote:
Originally Posted by napz View Post
Big 3 year bump

Don't want to create a new thread if this lovely one exists.
I am also wondering how to do this. The source code does talk about {GREEN} and {LIGHT_RED} but I have no idea how to use those. Help appreciated.

Edit: figured it out.
Can u describe how u handled it ?
luciusxsein is offline
tchow
New Member
Join Date: Nov 2020
Old 11-23-2020 , 22:23   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #23

Quote:
Originally Posted by napz View Post
Big 3 year bump

Don't want to create a new thread if this lovely one exists.
I am also wondering how to do this. The source code does talk about {GREEN} and {LIGHT_RED} but I have no idea how to use those. Help appreciated.

Edit: figured it out.
Quote:
Originally Posted by luciusxsein View Post
Can u describe how u handled it ?

anyone can help me? how can i put greens only for the numbers of shots i gaven and red only for numbers of shots e taken??
tchow is offline
ErcouldnT
New Member
Join Date: Dec 2020
Old 12-27-2020 , 08:31   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #24

I don't want to see the players who I didn't interact with. Is there any solution for that? Thanks a lot.
ErcouldnT is offline
Mr.Freeman
Senior Member
Join Date: Nov 2013
Location: Canada
Old 12-29-2020 , 17:49   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #25

Quote:
Originally Posted by ErcouldnT View Post
I don't want to see the players who I didn't interact with. Is there any solution for that? Thanks a lot.
Try this, I added a check to ensure if only displays messages for players that the client damaged or took damage from. Note, I did not test this.

PHP Code:
#include <cstrike>
#include <sourcemod>

#include "include/common.inc"
#include "include/csgo_common.inc"

#pragma semicolon 1
#pragma newdecls required

ConVar g_hEnabled;
ConVar g_hAllowDmgCommand;
ConVar g_hMessageFormat;
ConVar g_ExcludeBots;

int g_DamageDone[MAXPLAYERS+1][MAXPLAYERS+1];
int g_DamageDoneHits[MAXPLAYERS+1][MAXPLAYERS+1];

public 
Plugin myinfo = {
    
name "[CS:GO] Damage printer",
    
author "splewis",
    
description "Writes out player damage on round end or when .dmg is used",
    
version "1.0.0",
    
url "https://github.com/splewis/sm-misc"
};

public 
void OnPluginStart() {
    
g_hEnabled CreateConVar("sm_damageprint_enabled""1""Whether the plugin is enabled");
    
g_hAllowDmgCommand CreateConVar("sm_damageprint_allow_dmg_command""1""Whether players can type .dmg to see damage done");
    
g_hMessageFormat CreateConVar("sm_damageprint_format""--> ({DMG_TO} dmg / {HITS_TO} hits) to ({DMG_FROM} dmg / {HITS_FROM} hits) from {NAME} ({HEALTH} HP)""Format of the damage output string. Avaliable tags are in the default, color tags such as {LIGHT_RED} and {GREEN} also work.");
    
g_ExcludeBots CreateConVar("sm_damageprint_exclude_bots""0""Whether to exclude bots in damage reports");

    
AutoExecConfig();
    
RegConsoleCmd("sm_dmg"Command_Damage"Displays damage done");

    
HookEvent("round_start"Event_RoundStart);
    
HookEvent("player_hurt"Event_DamageDealtEventHookMode_Pre);
    
HookEvent("round_end"Event_RoundEndEventHookMode_Post);
}

static 
void PrintDamageInfo(int client) {
    if (!
IsValidClient(client))
        return;

    
int team GetClientTeam(client);
    if (
team != CS_TEAM_T && team != CS_TEAM_CT)
        return;

    
char message[256];

    
int otherTeam = (team == CS_TEAM_T) ? CS_TEAM_CT CS_TEAM_T;
    for (
int i 1<= MaxClientsi++) {
        if (
IsValidClient(i) && GetClientTeam(i) == otherTeam && (g_DamageDone[client][i] > || g_DamageDone[i][client] > 0))) {
            if (
g_ExcludeBots.IntValue != && IsFakeClient(i)) {
                continue;
            }

            
int health IsPlayerAlive(i) ? GetClientHealth(i) : 0;
            
char name[64];
            
GetClientName(inamesizeof(name));

            
g_hMessageFormat.GetString(messagesizeof(message));
            
ReplaceStringWithInt(messagesizeof(message), "{DMG_TO}"g_DamageDone[client][i], false);
            
ReplaceStringWithInt(messagesizeof(message), "{HITS_TO}"g_DamageDoneHits[client][i], false);
            
ReplaceStringWithInt(messagesizeof(message), "{DMG_FROM}"g_DamageDone[i][client], false);
            
ReplaceStringWithInt(messagesizeof(message), "{HITS_FROM}"g_DamageDoneHits[i][client], false);
            
ReplaceString(messagesizeof(message), "{NAME}"namefalse);
            
ReplaceStringWithInt(messagesizeof(message), "{HEALTH}"healthfalse);

            
Colorize(messagesizeof(message));
            
PrintToChat(clientmessage);
        }
    }
}

public 
Action Command_Damage(int clientint args) {
    if (
g_hEnabled.IntValue == || g_hAllowDmgCommand.IntValue == 0)
        return;

    if (
IsPlayerAlive(client)) {
        
ReplyToCommand(client"You cannot use that command when alive.");
        return;
    }

    
PrintDamageInfo(client);
}

public 
Action Event_RoundEnd(Event event, const char[] namebool dontBroadcast) {
    if (
g_hEnabled.IntValue == 0)
        return;

    for (
int i 1<= MaxClientsi++) {
        if (
IsValidClient(i)) {
            
PrintDamageInfo(i);
        }
    }
}

public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast) {
    for (
int i 1<= MaxClientsi++) {
        for (
int j 1<= MaxClientsj++) {
            
g_DamageDone[i][j] = 0;
            
g_DamageDoneHits[i][j] = 0;
        }
    }
}

public 
Action Event_DamageDealt(Event event, const char[] namebool dontBroadcast) {
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    
int victim GetClientOfUserId(event.GetInt("userid"));
    
bool validAttacker IsValidClient(attacker);
    
bool validVictim IsValidClient(victim);

    if (
validAttacker && validVictim) {
        
int preDamageHealth GetClientHealth(victim);
        
int damage event.GetInt("dmg_health");
        
int postDamageHealth event.GetInt("health");

        
// this maxes the damage variables at 100,
        // so doing 50 damage when the player had 2 health
        // only counts as 2 damage.
        
if (postDamageHealth == 0) {
            
damage += preDamageHealth;
        }

        
g_DamageDone[attacker][victim] += damage;
        
g_DamageDoneHits[attacker][victim]++;
    }

__________________
Feel Free to PM me about any questions, I'll do my best to help
Mr.Freeman is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:49.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode