Raised This Month: $32 Target: $400
 8% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
faraguti
Junior Member
Join Date: Feb 2017
Old 02-20-2017 , 00:00   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #11

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

To:
#include <common>
#include <csgo_common>
now it works!! thank you very much!!!


Another Question: Is there any way of coloring the text of this script? Like coloring the damage...
faraguti is offline
itsmejay
Junior Member
Join Date: Feb 2017
Old 02-21-2017 , 07:41   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #12

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

To:
#include <common>
#include <csgo_common>
Hello,

I've changed everything. Just as you said. But it does not work...

I compress this code (after change):

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

#include <common>
#include <csgo_common>

#pragma semicolon 1
#pragma newdecls required

ConVar g_hEnabled;
ConVar g_hAllowDmgCommand;
ConVar g_hMessageFormat;

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.");

    
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) {
            
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]++;
    }

Error:
PHP Code:
/groups/sourcemod/upload_tmp/texti8BHjo.sp(4) : fatal error 182cannot read from file"common"  Compilation aborted1 Error
When I download the file, the same happens. How do I fix the error?

Sorry for my bad english. Thank you all.

JAY
itsmejay is offline
spancer35
Senior Member
Join Date: Dec 2014
Location: City 17
Old 02-25-2017 , 17:26   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #13

I can't compile it. Is there any way to use that?
__________________
spancer35 is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 02-25-2017 , 17:35   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #14

Quote:
Originally Posted by itsmejay View Post
Hello,

I've changed everything. Just as you said. But it does not work...

I compress this code (after change):

...

Error:
Code:
/groups/sourcemod/upload_tmp/texti8BHjo.sp(4) : fatal error 182: cannot read from file: "common"  Compilation aborted. 1 Error.
When I download the file, the same happens. How do I fix the error?

Sorry for my bad english. Thank you all.

JAY
Quote:
Originally Posted by spancer35 View Post
I can't compile it. Is there any way to use that?
https://github.com/splewis/sm-misc/t...ipting/include
__________________
coding & free software

Last edited by shanapu; 02-25-2017 at 17:35.
shanapu is offline
spancer35
Senior Member
Join Date: Dec 2014
Location: City 17
Old 02-25-2017 , 18:21   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #15

Quote:
Originally Posted by shanapu View Post
Quote:
Originally Posted by spancer35 View Post
I can't compile it. Is there any way to use that?
Spoiler



can someone send it as compiled?
__________________

Last edited by spancer35; 02-25-2017 at 18:50.
spancer35 is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 02-25-2017 , 18:41   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #16

Quote:
Originally Posted by spancer35 View Post
Spoiler
Now, you send your error which is an other than the poster before, why not send error on first post?
An error is much more Meaningful than an unkindly "I can't compile it".

Are you sure you have the downloaded right files. check your files content. I assume you haven't download the RAW files from github.

This compile fine with the edit by oaaron99 & the files linked above.

Spoiler
__________________
coding & free software
shanapu is offline
spancer35
Senior Member
Join Date: Dec 2014
Location: City 17
Old 02-25-2017 , 18:49   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #17

Quote:
Originally Posted by shanapu View Post
Now, you send your error which is an other than the poster before, why not send error on first post?
An error is much more Meaningful than an unkindly "I can't compile it".

Are you sure you have the downloaded right files. check your files content. I assume you haven't download the RAW files from github.

This compile fine with the edit by oaaron99 & the files linked above.

Spoiler
Dude, i'm sorry about my rude(!) words. That was my fault I wasn't download it as a RAW.

Thank you a lot. Have a nice day
Blocked Attachments
File Type: smx csgo_damageprint.smx
__________________

Last edited by spancer35; 02-25-2017 at 18:51.
spancer35 is offline
splewis
Veteran Member
Join Date: Feb 2014
Location: United States
Old 02-26-2017 , 02:42   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #18

fyi, if you went to the readme for the repository I linked, there's a link to continuous builds for those plugins: https://ci.splewis.net/job/sm-misc/lastSuccessfulBuild/

I certainly encourage you to learn to compile plugins yourself though
__________________
splewis is offline
faraguti
Junior Member
Join Date: Feb 2017
Old 02-27-2017 , 10:05   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #19

guys, is there any way i can color the texts?

like, red to the damage i took and green to the damage i did?
faraguti is offline
napz
New Member
Join Date: Mar 2020
Old 03-03-2020 , 04:03   Re: Looking for "Damage done" Plugin, which prints in chat (ESEA-Like)
Reply With Quote #20

Quote:
Originally Posted by faraguti View Post
guys, is there any way i can color the texts?

like, red to the damage i took and green to the damage i did?
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.

Last edited by napz; 03-04-2020 at 07:28. Reason: Figured out problem on my own.
napz 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 21:56.


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