AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Solved [L4D2] Damage Reduction when equip riotshield (https://forums.alliedmods.net/showthread.php?t=339841)

ddd123 10-03-2022 20:15

[L4D2] Damage Reduction when equip riotshield
 
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?

HarryPotter 10-03-2022 21:53

Re: [L4D2] Damage Reduction when equip riotshield
 
How do you get riot shield in game?

Marttt 10-03-2022 21:58

Re: [L4D2] Damage Reduction when equip riotshield
 
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.

moschinovac 10-04-2022 06:47

Re: [L4D2] Damage Reduction when equip riotshield
 
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 >.>

ddd123 10-04-2022 08:01

Re: [L4D2] Damage Reduction when equip riotshield
 
Quote:

Originally Posted by moschinovac (Post 2790373)
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.

moschinovac 10-04-2022 08:54

Re: [L4D2] Damage Reduction when equip riotshield
 
1 Attachment(s)
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;



ddd123 10-04-2022 09:44

Re: [L4D2] Damage Reduction when equip riotshield
 
Quote:

Originally Posted by moschinovac (Post 2790381)
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!


All times are GMT -4. The time now is 17:12.

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