Raised This Month: $ Target: $400
 0% 

[L4D] Damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Sunyata
Senior Member
Join Date: Nov 2017
Location: Wherever I am
Plugin ID:
754
Plugin Version:
1.0
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Allows you turn damage on/off for infected and friendly fire
    Old 08-04-2018 , 03:05   Re: [L4D] Damage
    Reply With Quote #1

    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, 74 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 #2

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

    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 #3

    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 #4

    @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 #5

    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 21:57.


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