Raised This Month: $18 Target: $400
 4% 

Solved [L4D2] Damage Reduction when equip riotshield


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ddd123
Senior Member
Join Date: May 2021
Old 10-03-2022 , 21:15   [L4D2] Damage Reduction when equip riotshield
Reply With Quote #1

Hi, i know this is old plugin and too scare to call me necro but can someone make L4D2 Damage Reduction but only reduce while i'm equipping riot shield only please?

Last edited by ddd123; 10-04-2022 at 10:45.
ddd123 is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Taipei
Old 10-03-2022 , 22:53   Re: [L4D2] Damage Reduction when equip riotshield
Reply With Quote #2

How do you get riot shield in game?
__________________
HarryPotter is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 10-03-2022 , 22:58   Re: [L4D2] Damage Reduction when equip riotshield
Reply With Quote #3

Workshop has some related addons to unlock:

https://steamcommunity.com/sharedfil...?id=1827847412

Didn't test but if you search you can find more.

Anyway riotshield is kinda a bait cause there is a plugin that you "equip" but actually it is only attached to yourself.
So maybe what OP wants is not exactly what is asking for if that is the case.
__________________
Marttt is offline
moschinovac
Member
Join Date: Mar 2019
Location: Vietnam
Old 10-04-2022 , 07:47   Re: [L4D2] Damage Reduction when equip riotshield
Reply With Quote #4

this plugin already does that in "Front Mode", right?

https://forums.alliedmods.net/showthread.php?t=172316

U can modify to reduce both Front and Back while Hold Shield. And remove "Back Mode" too~

But duh, Riotshield without Workshop Mod is glitch as hell >.>
moschinovac is offline
ddd123
Senior Member
Join Date: May 2021
Old 10-04-2022 , 09:01   Re: [L4D2] Damage Reduction when equip riotshield
Reply With Quote #5

Quote:
Originally Posted by moschinovac View Post
this plugin already does that in "Front Mode", right?

https://forums.alliedmods.net/showthread.php?t=172316

U can modify to reduce both Front and Back while Hold Shield. And remove "Back Mode" too~

But duh, Riotshield without Workshop Mod is glitch as hell >.>
I know that plugin is exist
But i want a simple damage reduction when damage reduce activated during equip riotshield as melee weapon (and remove damage reduction when switch weapon or drop riotshield). Without front mode and back mode.

Last edited by ddd123; 10-04-2022 at 09:04.
ddd123 is offline
moschinovac
Member
Join Date: Mar 2019
Location: Vietnam
Old 10-04-2022 , 09:54   Re: [L4D2] Damage Reduction when equip riotshield
Reply With Quote #6

Here's "Lazy" version modify from that plugin. Haven't tested
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#pragma semicolon 1


Handle l4d_shield_damage_from_ci;
Handle l4d_shield_damage_from_si;
Handle l4d_shield_damage_from_tankwitch;


public 
void OnPluginStart()
{
    
    
l4d_shield_damage_from_ci CreateConVar("l4d_shield_damage_from_ci""0.0""ci damage to survivor with shield[0.0, 100.0]" );
      
l4d_shield_damage_from_si CreateConVar("l4d_shield_damage_from_si""10.0""si damage to survivor with shield[0.0, 100.0]" );
      
l4d_shield_damage_from_tankwitch CreateConVar("l4d_shield_damage_from_tankwitch""20.0""tank or witch damage to survivor with shield[0.0, 100.0]" );


    
AutoExecConfig(true"shield_l4d_snipset");
    
}

public 
void OnClientPutInServer(int client)
{
    if(
IsValidClient(client))
    {
        
SDKHook(clientSDKHook_OnTakeDamagePlayerOnTakeDamage);
    }
}

HoldShieldWeapon(client)
{
    
int ent=GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
    if(
ent>0)
    {
        
decl String:item[64];
        
GetEdictClassname(ent,  itemsizeof(item));
        if(
StrEqual(item"weapon_melee"))
        {
            
GetEntPropString(entProp_Data"m_ModelName"itemsizeof(item));
            if(
StrContains(item"shield")>0)
            {
                return 
ent;
            }
        }
    }
    return 
0;
}


public 
Action PlayerOnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    if(
victim<=0)return Plugin_Continue;
    
    if(
GetClientTeam(victim) != 2) return Plugin_Continue;
    
    if(!
HoldShieldWeapon(victim)) return Plugin_Continue;
    
    
float damageFactor=100.0;
    
    if(
attacker>&& attacker<=MaxClients)
    {
        if(
GetEntProp(attackerProp_Send"m_zombieClass") == 8)
        {
            
damageFactor=GetConVarFloat(l4d_shield_damage_from_tankwitch);
        }
        else 
            
damageFactor=GetConVarFloat(l4d_shield_damage_from_si);
    }
    else
    {
        
char name[64];
        
GetEdictClassname(attackername64);
        if(
StrEqual(name"infected"))
        {
            
damageFactor=GetConVarFloat(l4d_shield_damage_from_ci);
        }
        else if(
StrEqual(name"tank_rock"))
        {
            
damageFactor=GetConVarFloat(l4d_shield_damage_from_tankwitch);
        }
        else 
            return 
Plugin_Continue;
    }

    

    
damageFactor=damageFactor*0.01;


    
damage=damage*damageFactor;

    return 
Plugin_Changed;
}


bool IsValidClient(int client)
{
    if (
client || client MaxClients
        return 
false;
    
    if (!
IsClientConnected(client)) 
        return 
false;
    
    if (!
IsClientInGame(client)) 
        return 
false;
    
    return 
true;

Attached Files
File Type: sp Get Plugin or Get Source (shield_l4d_snipset.sp - 16 views - 2.4 KB)
moschinovac is offline
ddd123
Senior Member
Join Date: May 2021
Old 10-04-2022 , 10:44   Re: [L4D2] Damage Reduction when equip riotshield
Reply With Quote #7

Quote:
Originally Posted by moschinovac View Post
Here's "Lazy" version modify from that plugin. Haven't tested
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#pragma semicolon 1


Handle l4d_shield_damage_from_ci;
Handle l4d_shield_damage_from_si;
Handle l4d_shield_damage_from_tankwitch;


public 
void OnPluginStart()
{
    
    
l4d_shield_damage_from_ci CreateConVar("l4d_shield_damage_from_ci""0.0""ci damage to survivor with shield[0.0, 100.0]" );
      
l4d_shield_damage_from_si CreateConVar("l4d_shield_damage_from_si""10.0""si damage to survivor with shield[0.0, 100.0]" );
      
l4d_shield_damage_from_tankwitch CreateConVar("l4d_shield_damage_from_tankwitch""20.0""tank or witch damage to survivor with shield[0.0, 100.0]" );


    
AutoExecConfig(true"shield_l4d_snipset");
    
}

public 
void OnClientPutInServer(int client)
{
    if(
IsValidClient(client))
    {
        
SDKHook(clientSDKHook_OnTakeDamagePlayerOnTakeDamage);
    }
}

HoldShieldWeapon(client)
{
    
int ent=GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
    if(
ent>0)
    {
        
decl String:item[64];
        
GetEdictClassname(ent,  itemsizeof(item));
        if(
StrEqual(item"weapon_melee"))
        {
            
GetEntPropString(entProp_Data"m_ModelName"itemsizeof(item));
            if(
StrContains(item"shield")>0)
            {
                return 
ent;
            }
        }
    }
    return 
0;
}


public 
Action PlayerOnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    if(
victim<=0)return Plugin_Continue;
    
    if(
GetClientTeam(victim) != 2) return Plugin_Continue;
    
    if(!
HoldShieldWeapon(victim)) return Plugin_Continue;
    
    
float damageFactor=100.0;
    
    if(
attacker>&& attacker<=MaxClients)
    {
        if(
GetEntProp(attackerProp_Send"m_zombieClass") == 8)
        {
            
damageFactor=GetConVarFloat(l4d_shield_damage_from_tankwitch);
        }
        else 
            
damageFactor=GetConVarFloat(l4d_shield_damage_from_si);
    }
    else
    {
        
char name[64];
        
GetEdictClassname(attackername64);
        if(
StrEqual(name"infected"))
        {
            
damageFactor=GetConVarFloat(l4d_shield_damage_from_ci);
        }
        else if(
StrEqual(name"tank_rock"))
        {
            
damageFactor=GetConVarFloat(l4d_shield_damage_from_tankwitch);
        }
        else 
            return 
Plugin_Continue;
    }

    

    
damageFactor=damageFactor*0.01;


    
damage=damage*damageFactor;

    return 
Plugin_Changed;
}


bool IsValidClient(int client)
{
    if (
client || client MaxClients
        return 
false;
    
    if (!
IsClientConnected(client)) 
        return 
false;
    
    if (!
IsClientInGame(client)) 
        return 
false;
    
    return 
true;

Thank you very much for a modify plugin moschinovac! Tested and it work looking fine!

Last edited by ddd123; 10-04-2022 at 10:44.
ddd123 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 09:59.


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