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

Request - l4d2 reflect damage plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wendigo
Senior Member
Join Date: Nov 2012
Location: Denmark
Old 10-05-2017 , 14:52   Request - l4d2 reflect damage plugin
Reply With Quote #1

I need a reflect damage plugin for my l4d2 server. I know there are 1 or 2 out there. But they are outdated, and doesnt offer what I need. I dont have the time or experience to do this myself.
So I am kindly asking a programmer or just someone with great knowldege, to help me out?
I do have some leftovers from an old plugin in .smx format on my desktop. But dont know if I'm allowed to attach it?

I need a reflect damage plugin for l4d2, for my server. The old plugin I got, is the one attached.


.....These items below, must be left unchanged. In other words, default settings:

-Molotov

-Pipebomb

-Gas can

-Propane


.....Stuff this reflect damage plugin must and needs to cover:

-Melee damage from all weapons (chainsaw also included)

-Grenade launcher

-Normal bullet and greande damage from weapons

-Incendiary ammo for all weapons

-Explosive ammo for all weapons
wendigo is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-06-2017 , 02:59   Re: Request - l4d2 reflect damage plugin
Reply With Quote #2

Reflect damage all players or teammates ??

PHP Code:
#include <sdktools>
#include <sdkhooks>

public void OnPluginStart()
{
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i)) OnClientPutInServer(i);
    }

}

public 
void OnClientPutInServer(client)
{
    
SDKHookEx(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    if( !(
attacker <= MaxClients) || !IsClientInGame(attacker) || victim == attacker) return Plugin_Continue;

    if(
GetClientTeam(victim) == GetClientTeam(attacker))
    {
        
int weapon GetEntPropEnt(attackerProp_Send"m_hActiveWeapon");

        if(
attacker != inflictorweapon inflictor;

        
char classname[MAX_NAME_LENGTH];
        
GetEntityClassname(weaponclassnamesizeof(classname));

        if(
StrEqual(classname"inferno"false) || StrEqual(classname"pipe_bomb_projectile"false)) return Plugin_Continue;

        
//PrintToServer("classname %s", classname);
        //inferno
        //pipe_bomb_projectile

        
SDKHooks_TakeDamage(attackerinflictorattackerdamagedamagetypeweapon);

        
damage 0.0;
        return 
Plugin_Changed;
    }

    return 
Plugin_Continue;

__________________
Do not Private Message @me

Last edited by Bacardi; 10-06-2017 at 03:32.
Bacardi is offline
wendigo
Senior Member
Join Date: Nov 2012
Location: Denmark
Old 10-06-2017 , 13:44   Re: Request - l4d2 reflect damage plugin
Reply With Quote #3

I use my server as co-op only, so I just need teammates?
wendigo is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-06-2017 , 13:47   Re: Request - l4d2 reflect damage plugin
Reply With Quote #4

Ok. Try that version what I posted.
I did it in hurry...
__________________
Do not Private Message @me

Last edited by Bacardi; 10-06-2017 at 13:48.
Bacardi is offline
wendigo
Senior Member
Join Date: Nov 2012
Location: Denmark
Old 10-06-2017 , 14:55   Re: Request - l4d2 reflect damage plugin
Reply With Quote #5

Thanks man. I'll upload it straight away and see how it goes
wendigo is offline
wendigo
Senior Member
Join Date: Nov 2012
Location: Denmark
Old 10-07-2017 , 17:41   Re: Request - l4d2 reflect damage plugin
Reply With Quote #6

I'm not sure if its related to the plugin. But I uploaded the plugin yesterday and around 1½ hour later my server crashed. It has never crashed before.
How do I know if this plugin causes the issue?
Can I check logs? If yes, what kinds of logs?
wendigo is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-07-2017 , 17:49   Re: Request - l4d2 reflect damage plugin
Reply With Quote #7

Hmmm, try comment with double slash that take damage part.
//SDKHooks_TakeDamage
And try again, will it still crash?

*edit.
Maybe invalid weapon index -1 had passed through code...
I look later, need to go work.

Sourcemod logs
__________________
Do not Private Message @me

Last edited by Bacardi; 10-07-2017 at 17:52.
Bacardi is offline
wendigo
Senior Member
Join Date: Nov 2012
Location: Denmark
Old 10-15-2017 , 12:21   Re: Request - l4d2 reflect damage plugin
Reply With Quote #8

Cheers.
I really appreciate you are taking the time to help me with this plugin.
I'll upload the plugin again.

Bonus questions:
1) Is it possible to make the plugin bypass when a survivor is getting pinned by a special infected? It is very hard to save a fellow survivor from a hunter, without getting the damage reflected to yourself in the process.

2) Admin bypass, so admin can still harm survivors. Possible?
wendigo is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-16-2017 , 09:36   Re: Request - l4d2 reflect damage plugin
Reply With Quote #9

1) yes, but after you said, server crashed because
2nd post plugin, I suggest remove SDKHooks_TakeDamage part. It not give dmg after this.
To see will it still crash.

2) yes possible.

...I'm little busy at work. Last two nights have been 16 hours.
I edit later or someone another can help to do this also.
__________________
Do not Private Message @me

Last edited by Bacardi; 10-16-2017 at 09:37.
Bacardi is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-17-2017 , 18:39   Re: Request - l4d2 reflect damage plugin
Reply With Quote #10

Updated. I added SDKHook_TakeDamage back.
And check is attacker still alive and weapon have not null index.
Added some pinned checks

PHP Code:
#include <sdktools>
#include <sdkhooks>

bool IsAdmin[MAXPLAYERS+1];

public 
void OnPluginStart()
{
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i) && IsClientAuthorized(i)) OnClientPostAdminCheck(i);
    }

}

public 
void OnClientPostAdminCheck(client)
{
    
SDKHookEx(clientSDKHook_OnTakeDamageOnTakeDamage);
    
IsAdmin[client] = CheckCommandAccess(client"sm_admin"ADMFLAG_GENERIC);
}

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    if( !(
attacker <= MaxClients) || !IsClientInGame(attacker) || victim == attacker || IsAdmin[attacker]) return Plugin_Continue;

    if(
GetClientTeam(victim) == GetClientTeam(attacker))
    {
        
int weapon GetEntPropEnt(attackerProp_Send"m_hActiveWeapon");

        if(
attacker != inflictorweapon inflictor;

        
// Fix bug?
        
if(!IsPlayerAlive(attacker) || weapon == -1) return Plugin_Handled;

        
char classname[MAX_NAME_LENGTH];
        
GetEntityClassname(weaponclassnamesizeof(classname));

        if(
StrEqual(classname"inferno"false) || StrEqual(classname"pipe_bomb_projectile"false)) return Plugin_Continue;

        
//PrintToServer("classname %s %f", classname, damage);
        //inferno
        //pipe_bomb_projectile

        
if(  GetEntPropEnt(victimProp_Send"m_pounceAttacker") == -&& // hunter
             
GetEntPropEnt(victimProp_Send"m_jockeyAttacker") == -&& // jockey
             
GetEntPropEnt(victimProp_Send"m_tongueOwner") == -&& // tongue
             
GetEntPropEnt(victimProp_Send"m_carryAttacker") == -&& // charger
             
GetEntPropEnt(victimProp_Send"m_pummelAttacker") == -&& // charger ??
            
!GetEntProp(victimProp_Send"m_isIncapacitated") &&
            !
GetEntProp(victimProp_Send"m_isHangingFromLedge") )
            {
                
SDKHooks_TakeDamage(attackerinflictorattackerdamagedamagetypeweapon);
                
//PrintToServer("-classname %s %f", classname, damage);
            
}

        
damage 0.0;
        return 
Plugin_Changed;
    }

    return 
Plugin_Continue;

__________________
Do not Private Message @me

Last edited by Bacardi; 10-17-2017 at 18:40.
Bacardi is offline
Reply


Thread Tools
Display Modes

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 11:10.


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