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

[L4D] Damage


Post New Thread Reply   
 
Thread Tools Display Modes
bdmj
Member
Join Date: Jan 2010
Old 02-23-2012 , 18:56   Re: [L4D] Damage
Reply With Quote #41

how do you bind a key to switch ff on and off? I've tried l4d_damage_ff 1 and 2 and it says it's not recognized. I've tried sm_cvar l4d_damage_ff 2 and 1 and the same thing. How do I bind a key to switch them on and off. bind z "l4d_damage_ff 2" and bind z "sm_cvar l4d_damage_ff 2" don't work.
__________________
bdmj is offline
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Old 07-08-2018 , 10:06   Re: [L4D] Damage
Reply With Quote #42

There's been a never-ending issue with the author's plugin when using the 'mirror' option for FF damage, where players taking damage below zero on the health bar find they are never incapped, and instead are left standing but cannot crouch anymore, and sometimes they may lose some info from the HUD interface too -- I see that this issue was also addressed at post #20 back in 2009.

As this plugin is not supported anymore, I have -out of desperation- hacked the script myself (I'm not a coder btw) to find a workaround solution to "fix" this nuisance bug/glitch once and for all. I've managed to find a way that corrects this fault; but it doesn't fix it by incapping the player as it should do, but by stopping the HP bar from entering a minus zero value. It's not a perfect fix by any means, but it does at least now stop the crouching and HUD bugs from happening.

I've attached the plugin here should anyone wish to use it.

It's important to note not to adjust the plugin's config file, use only the default values generated by the script. This plugin works with the 'mirror' option only, and will run on Windows servers for L4D 1 & 2, and Linux server for L4D1.
Attached Files
File Type: smx MirroredFFDamageFIXED-version-2.smx (8.2 KB, 128 views)

Last edited by Sunyata; 07-24-2018 at 10:09. Reason: updated plugin to fix log errors - version 2
Sunyata is offline
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Old 08-04-2018 , 03:05   Re: [L4D] Damage
Reply With Quote #43

Further to my post 42, I've finally managed to get player incapacitation to work with the mirrored friendly fire. I'll still leave the above plugin though, as that one doesn't incap the player but adds a rebound effect (or heavy slap) that punishes the player instead - which some players may prefer instead of this latest plugin here.

This new plugin however can occasionally create a few log errors, it's nothing drastic, but I really don't know how to fix those errors. But if any coder wishes to address that issue in the future, then just PM me and I'll send my modded script.
Attached Files
File Type: smx MirroredFFDamageIncapFIXED.smx (6.9 KB, 69 views)

Last edited by Sunyata; 10-08-2019 at 04:50. Reason: plugin updated to remove 3 messages at request of player
Sunyata is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 08-04-2018 , 03:35   Re: [L4D] Damage
Reply With Quote #44

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^

You got lysised
https://www.sourcemod.net/license.php

Sharing the source in the post will most likely get you help

PHP Code:
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
#define VERSION "0.9.7"

new Handle:melee_damage;
new 
Handle:head_damage;
new 
Handle:chest_damage;
new 
Handle:stomach_damage;
new 
Handle:arm_damage;
new 
Handle:leg_damage;
new 
Handle:ff_damage;
new 
Handle:shove_damage;
new 
down_counts[66];

public 
Plugin:myinfo =
{
    
name "L4D Damage",
    
description "Adds damage related cvars.",
    
author "Voiderest",
    
version VERSION,
    
url "N/A"
};

public 
OnPluginStart()
{
    
melee_damage CreateConVar("l4d_damage_melee""1""0: Melee does no damage."FCVAR_REPLICATED|FCVAR_GAMEDLL|FCVAR_NOTIFYtrue0.0true1.0);
    
head_damage CreateConVar("l4d_damage_head_only""0""1: Head damage only."FCVAR_REPLICATED|FCVAR_GAMEDLL|FCVAR_NOTIFYtrue0.0true1.0);
    
chest_damage CreateConVar("l4d_damage_chest""1""1: Allow chest damage."FCVAR_REPLICATED|FCVAR_GAMEDLL|FCVAR_NOTIFYtrue0.0true1.0);
    
stomach_damage CreateConVar("l4d_damage_stomach""1""1: Allow stomach damage."FCVAR_REPLICATED|FCVAR_GAMEDLL|FCVAR_NOTIFYtrue0.0true1.0);
    
arm_damage CreateConVar("l4d_damage_arm""0""1: Allow arm damage."FCVAR_REPLICATED|FCVAR_GAMEDLL|FCVAR_NOTIFYtrue0.0true1.0);
    
leg_damage CreateConVar("l4d_damage_leg""1""1: Allow leg damage."FCVAR_REPLICATED|FCVAR_GAMEDLL|FCVAR_NOTIFYtrue0.0true1.0);
    
ff_damage CreateConVar("l4d_damage_ff""2""0: FF off 1: FF normal 2: FF reverse 3: FF split"FCVAR_REPLICATED|FCVAR_GAMEDLL|FCVAR_NOTIFYtrue0.0true3.0);
    
shove_damage CreateConVar("l4d_damage_shove""0""The amount of damage shoving a player does"FCVAR_REPLICATED|FCVAR_GAMEDLL|FCVAR_NOTIFYtrue0.0false0.0);
    
HookConVarChange(head_damageHeadshot_Only);
    
HookEvent("infected_hurt"Event_Infected_HurtEventHookMode_Pre); 
    
HookEvent("player_hurt"Event_Player_HurtEventHookMode_Pre);
    
HookEvent("player_shoved"Event_Player_ShovedEventHookMode_Pre);
    
HookEvent("player_incapacitated"Event_Player_IncapacitatedEventHookMode_Pre);
    
HookEvent("heal_success"Event_Heal_SuccessEventHookMode_Pre);
    
HookEvent("player_death"Event_Player_DeathEventHookMode_Pre);
    
HookEvent("player_first_spawn"Event_Player_First_SpawnEventHookMode_Pre);
    
AutoExecConfig(true"MirroredFFDamageIncap");
}

public 
OnClientPostAdminCheck(client)
{
    
GetConVarInt(head_damage);
}

public 
Action:Event_Infected_Hurt(Handle:eventString:name[], bool:dontBroadcast)
{
    new 
zombieid GetEventInt(event"entityid");
    new 
hitgroup GetEventInt(event"hitgroup");
    new 
amount GetEventInt(event"amount");
    new 
type GetEventInt(event"type");
    return (
type == 128 && GetConVarInt(melee_damage)) || (GetConVarInt(head_damage) == || (hitgroup == && GetConVarInt(chest_damage)) || (hitgroup == && GetConVarInt(stomach_damage)) || ((hitgroup == || hitgroup == 5) && GetConVarInt(arm_damage) && ((hitgroup == || hitgroup == 7) && GetConVarInt(leg_damage))));
}

public 
Action:Event_Player_Hurt(Handle:eventString:name[], bool:dontBroadcast)
{
    new 
client_userid GetEventInt(event"userid");
    new 
client GetClientOfUserId(client_userid);
    new 
attacker_userid GetEventInt(event"attacker");
    new 
attacker GetClientOfUserId(attacker_userid);
    new 
health GetEventInt(event"health");
    new 
dmg GetEventInt(event"dmg_health");
    new 
type GetEventInt(event"type");
    new 
fftype GetConVarInt(ff_damage);
    if (
attacker && client && fftype == && (type == 64 || type == || type == 2056) && GetClientTeam(attacker) == GetClientTeam(client))
    {
        return 
Plugin_Continue;
    }
    
FF_Damage(clientattackerdmgfftypehealth);
    return 
Plugin_Continue;
}

public 
Action:Event_Player_Shoved(Handle:eventString:name[], bool:dontBroadcast)
{
    new 
attacker_userid GetEventInt(event"attacker");
    new 
attacker GetClientOfUserId(attacker_userid);
    new 
client_userid GetEventInt(event"userid");
    new 
client GetClientOfUserId(client_userid);
    new 
damage GetConVarInt(shove_damage);
    new 
fftype GetConVarInt(ff_damage);
    if (
attacker && client && fftype >= && damage <= && GetClientTeam(attacker) == GetClientTeam(client))
    {
        return 
Plugin_Continue;
    }
    new 
health GetEntProp(clientProp_Data"m_iHealth"40);
    if (
fftype == 1)
    {
        
SetEntProp(clientProp_Data"m_iHealth"health damage40);
        return 
Plugin_Continue;
    }
    
FF_Damage(clientattackerdamageGetConVarInt(ff_damage), health);
    return 
Plugin_Continue;
}

public 
FF_Damage(clientattackerdmgfftypehealth)
{
    if (
fftype)
    {
        if (
fftype == 2)
        {
            
SetEntProp(clientProp_Data"m_iHealth"dmg health40);
            
health GetEntProp(attackerProp_Data"m_iHealth"40);
            if (
>= health dmg)
            {
                
IgniteEntity(attacker5.0false0.0false);
                
CreateTimer(3.0SlapTimerattacker);
                
ClientCommand(attacker"play UI/beep22");
                if (
down_counts[GetClientOfUserId(attacker)] == 2)
                {
                    
SlapPlayer(attacker6false);
                }
            }
            
SetEntProp(attackerProp_Data"m_iHealth"health dmg40);
        }
        
dmg /= 2;
        
SetEntProp(clientProp_Data"m_iHealth"dmg health40);
        
health GetEntProp(attackerProp_Data"m_iHealth"40);
        if (
>= health dmg)
        {
            
IgniteEntity(attacker5.0false0.0false);
            if (
down_counts[GetClientOfUserId(attacker)] == 2)
            {
                
SlapPlayer(attacker1false);
            }
        }
        
SetEntProp(attackerProp_Data"m_iHealth"health dmg40);
    }
    else
    {
        
SetEntProp(clientProp_Data"m_iHealth"dmg health40);
    }
}

public 
Action:Event_Player_Incapacitated(Handle:eventString:name[], bool:dontBroadcast)
{
    new 
id GetClientOfUserId(GetEventInt(event"userid"));
    
down_counts[id] = down_counts[id] + 1;
    
PrintToChatAll("\x04 * * * A TEAM MATE IS INCAPPED!");
    
PrintToChatAll("\x04 * * * WARNING: \x03Too much friendly fire damage can get you killed.");
    
PrintToChatAll("\x04 * * * \x03When INCAPPED use \x04!helpme \x03to activate distress beacon so team-mates know you're in trouble.");
    return 
Plugin_Continue;
}

public 
Action:Event_Heal_Success(Handle:eventString:name[], bool:dontBroadcast)
{
    
down_counts[GetClientOfUserId(GetEventInt(event"subject"))] = 0;
    return 
Plugin_Continue;
}

public 
Action:Event_Player_Death(Handle:eventString:name[], bool:dontBroadcast)
{
    
down_counts[GetClientOfUserId(GetEventInt(event"userid"))] = 0;
    return 
Plugin_Continue;
}

public 
Action:Event_Player_First_Spawn(Handle:eventString:name[], bool:dontBroadcast)
{
    
down_counts[GetClientOfUserId(GetEventInt(event"userid"))] = 0;
    return 
Plugin_Continue;
}

public 
Headshot_Only(Handle:cvarString:oldVal[], String:newVal[])
{
    
StringToInt(newVal10);
}

public 
Action:SlapTimer(Handle:timerany:attacker)
{
    
SlapPlayer(attacker1false);
    
ClientCommand(attacker"play UI/helpful_event_1.wav");
    return 
Plugin_Continue;

__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D

Last edited by Lux; 08-04-2018 at 03:47.
Lux is offline
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Old 08-05-2018 , 05:41   Re: [L4D] Damage
Reply With Quote #45

I'm too embarrassed to share my attempts as I'm not really a coder.

I'll only share the edited script for the above I'if anyone really asks for it here. btw I have posted scripts and edits versions of them at these forums before, so I am aware of the rules to most extents. but I made an exception with this one script for personal reasons. ;)
Sunyata is offline
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Old 08-05-2018 , 06:10   Re: [L4D] Damage
Reply With Quote #46

@lux, have you optimized that script? its about 50 lines shorter than before. It compiled and loaded ingame just fine, but when I tried to incap another player using the mirror FF damage it just kicked me off the l4d Windows server every time. There are no error messages/reports being generated for this fault either, so I can't give any further feedback to help here.

Last edited by Sunyata; 08-05-2018 at 06:12.
Sunyata is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 08-05-2018 , 10:01   Re: [L4D] Damage
Reply With Quote #47

nah i did not optimize it it's just what lysis gave me and i made it compile
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux 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 03:00.


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