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

[L4D] L4DNoSmoking (v1.0.5, 2019-07-23)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Plugin ID:
6651
Plugin Version:
1.0.0
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    This plugin prevents the smoker from smoking the last survivor.
    Old 07-20-2019 , 13:07   [L4D] L4DNoSmoking (v1.0.5, 2019-07-23)
    Reply With Quote #1

    Description:
    This plugin prevents the smoker from smoking the last survivor.
    It checks for the following status:
    1 survivor running around
    the other survivors dead, incapped, pounced, smoked, smoked from ledge, hanging from ledge or falling from ledge.

    Tested on L4D1. Included conditions for L4D2 but untested.

    Feature:
    Use cfg to set the server to automatically slap the smoker to break his tongue or kill the smoker, when he tries to smoke the last survivor.

    CVAR/Command list:
    killorslap (default=1) 1 = kill smoker / 2 = slap smoker
    displaykillmessage (default=3) 0 - Disabled; 1 - small HUD Hint; 2 - big HUD Hint ; 3 - Chat Notification

    Changelog:
    2019-07-20 (v1.0.0)
    * Initial release.
    2019-07-21 (v1.0.1)
    * Code cleanup and added language support by Aya Supay
    2019-07-23 (v1.0.5)
    * Code cleanup and added language support by Aya Supay
    * new code for handling survivors and cleanup by Lux

    Installation instructions:
    Click 'Get Plugin' button, place SMX in the sourcemod plugins folder. Or compile it yourself.
    Download 'l4d_nosmoking.phrases.txt' and place it in translations folder.

    Dependencies:
    none

    Plans:
    none atm

    Credits:
    Based on code snippets from:
    * [L4D, L4D2] No Death Check Until Dead
    * https://forums.alliedmods.net/showthread.php?t=142432
    * [L4D & L4D2] Survivor Bot Takeover v0.8
    * https://forums.alliedmods.net/showthread.php?p=1192594
    * xZk TeleportEntity suggestion to break tongue
    * Aya Supay code cleanup and added language support
    * Lux for different approach on tongue_grab and code cleanup
    Attached Files
    File Type: sp Get Plugin or Get Source (L4DNoSmoking1.0.5.sp - 748 views - 8.6 KB)
    File Type: txt l4d_nosmoking.phrases.txt (1.4 KB, 301 views)

    Last edited by finishlast; 07-24-2019 at 11:08.
    finishlast is offline
    theproperson
    Member
    Join Date: Feb 2017
    Old 07-20-2019 , 19:41   Re: [L4D] L4DNoSmoking (v1.0.0, 2019-07-20)
    Reply With Quote #2

    This plugin sounds beautiful. I've always been personally annoyed how smokers tend to unfairly deny clutch wins with their insane range, especially when you have a survivor fighting hordes / groups of the other specials.
    theproperson is offline
    Aya Supay
    Member
    Join Date: Nov 2015
    Old 07-21-2019 , 08:48   Re: [L4D] L4DNoSmoking (v1.0.0, 2019-07-20)
    Reply With Quote #3

    Quote:
    Originally Posted by finishlast View Post
    Description:
    This plugins prevents the smoker from smoking the last survivor.
    It checks for the following status:
    1 survivor running around
    the other survivors dead, incapped, pounced, smoked, smoked from ledge, hanging from ledge or falling from ledge.

    Tested on L4D1. Included conditions for L4D2 but untested.

    Feature:
    Use cfg to set the server to automatically slap the smoker to break his tongue or kill the smoker, when he tries to smoke the last survivor.

    CVAR/Command list:
    killorslap (default=1) 1 = kill smoker / 2 = slap smoker
    displaykillmessage (default=3) 0 - Disabled; 1 - small HUD Hint; 2 - big HUD Hint ; 3 - Chat Notification

    Changelog:
    2019-07-15 (v1.0.0)
    * Initial release.

    Installation instructions:
    Click 'Get Plugin' button, place SMX in the sourcemod plugins folder and you're done. Or compile it yourself.

    Dependencies:
    no idea about older versions of sourcemod, I compiled it with:
    SourcePawn Compiler 1.10.0.6356
    and
    SourcePawn Compiler 1.10.0.6393

    Plans:
    none atm

    Credits:
    Based on code snippets from:
    * [L4D, L4D2] No Death Check Until Dead (survivor/infected checks)
    * https://forums.alliedmods.net/showthread.php?t=142432
    * [L4D & L4D2] Survivor Bot Takeover v0.8 (check incap routine)
    * https://forums.alliedmods.net/showthread.php?p=1192594
    * And TeleportEntity suggestion by xZk to break tongue instead of using SlapPlayer

    nice job

    the code update a bit and add language support enjoy

    Last edited by Aya Supay; 07-22-2019 at 22:51.
    Aya Supay is offline
    finishlast
    Senior Member
    Join Date: Nov 2018
    Location: In Reno with the vitamin
    Old 07-21-2019 , 14:26   Re: [L4D] L4DNoSmoking (v1.0.1, 2019-07-21)
    Reply With Quote #4

    Wow man, that looks more like a complete rewrite. hahaha

    I uploaded your version to the first post.

    finishlast is offline
    theproperson
    Member
    Join Date: Feb 2017
    Old 07-22-2019 , 11:05   Re: [L4D] L4DNoSmoking (v1.0.1, 2019-07-21)
    Reply With Quote #5

    Works great and has overall improved the health of the game. I use the slap version since it seems pretty unfair to just outright kill the smoker. If you plan on doing more plugins I have a request in mind finishlast. How about damage immunity for 1 pound on the charger? That way he can actually finish his already slolw enough attack at least once before dieing since even with 600 health chargers seem to die as fast as boomers.
    theproperson is offline
    finishlast
    Senior Member
    Join Date: Nov 2018
    Location: In Reno with the vitamin
    Old 07-22-2019 , 14:38   Re: [L4D] L4DNoSmoking (v1.0.1, 2019-07-21)
    Reply With Quote #6

    Unfortunatelly I'm not playing L4D2 and and have no server to do that.

    I think it would be possible to use this plugin maybe, turn everything off in the cfg except:

    // Enables Survivor Aegis ability: While charging, the Charger will use the Survivor as an Aegis to absorb damage it would receive. (Def 1)
    l4d_ucm_survivoraegis "1"
    // Percent of damage the Charger avoids using a Survivor as an Aegis. (Def 0.2)
    l4d_ucm_survivoraegisamount "100.0"
    // How much damage is inflicted to the Survivor being used as an Aegis. (Def 5)
    l4d_ucm_survivoraegisdamage "0"

    So it would protect the charger 100%? MB that works.

    https://forums.alliedmods.net/showthread.php?p=2092125 newest version on the last page.

    Or you could go to the ideas forum and ask someone to turn this script here into your wanted behavior:
    It needs to be tweaked from tank to charger and needs a changed damage type, then maybe a hook on chargingstart to make him bullet- and fireproof and chargingend to make him normal again. But mb you just test the script mentioned above.

    https://forums.alliedmods.net/showpo...1&postcount=11


    **************************

    I just witnessed an issue with L4DNoSmoking in Aya Supay version. The server had 4 surviors running around and 4 infected and 2 spectators.

    The plugin slapped the smoker for smoking last but obviously there were still 4 up, or maybe 1 attacked by hunter (didnt see that though)

    OK what I found out so far, the variable survivors is 0 sometimes and incappedcount stays 0 too so 0-0=0 = slapkill

    I have a feeling it happens when there are 8 players and a spectator but that is just a feeling, not proved.

    The error must be here:

    if (IsClientInGame(i) && IsFakeClient(i) && GetClientTeam(i) == 2 && IsPlayerAlive(i) && GetClientHealth(i) > 0 )

    and here

    if (IsClientInGame(i) && IsFakeClient(i) && GetClientTeam(i) == 2)

    the only reason why the variables could stay 0.

    Any ideas? Why do you check for IsFakeClient? Think we can get rid of the && GetClientHealth(i) > 0 as well.


    Went back to 1.0.0 for download atm, have to understand what is wrong.

    Last edited by finishlast; 07-22-2019 at 19:33.
    finishlast is offline
    theproperson
    Member
    Join Date: Feb 2017
    Old 07-22-2019 , 22:13   Re: [L4D] L4DNoSmoking (v1.0.1, 2019-07-21)
    Reply With Quote #7

    Quote:
    Originally Posted by finishlast View Post
    Unfortunatelly I'm not playing L4D2 and and have no server to do that.

    I think it would be possible to use this plugin maybe, turn everything off in the cfg except:

    // Enables Survivor Aegis ability: While charging, the Charger will use the Survivor as an Aegis to absorb damage it would receive. (Def 1)
    l4d_ucm_survivoraegis "1"
    // Percent of damage the Charger avoids using a Survivor as an Aegis. (Def 0.2)
    l4d_ucm_survivoraegisamount "100.0"
    // How much damage is inflicted to the Survivor being used as an Aegis. (Def 5)
    l4d_ucm_survivoraegisdamage "0"

    So it would protect the charger 100%? MB that works.

    https://forums.alliedmods.net/showthread.php?p=2092125 newest version on the last page.

    Or you could go to the ideas forum and ask someone to turn this script here into your wanted behavior:
    It needs to be tweaked from tank to charger and needs a changed damage type, then maybe a hook on chargingstart to make him bullet- and fireproof and chargingend to make him normal again. But mb you just test the script mentioned above.

    https://forums.alliedmods.net/showpo...1&postcount=11


    **************************

    I just witnessed an issue with L4DNoSmoking in Aya Supay version. The server had 4 surviors running around and 4 infected and 2 spectators.

    The plugin slapped the smoker for smoking last but obviously there were still 4 up, or maybe 1 attacked by hunter (didnt see that though)

    OK what I found out so far, the variable survivors is 0 sometimes and incappedcount stays 0 too so 0-0=0 = slapkill

    I have a feeling it happens when there are 8 players and a spectator but that is just a feeling, not proved.

    The error must be here:

    if (IsClientInGame(i) && IsFakeClient(i) && GetClientTeam(i) == 2 && IsPlayerAlive(i) && GetClientHealth(i) > 0 )

    and here

    if (IsClientInGame(i) && IsFakeClient(i) && GetClientTeam(i) == 2)

    the only reason why the variables could stay 0.

    Any ideas? Why do you check for IsFakeClient? Think we can get rid of the && GetClientHealth(i) > 0 as well.


    Went back to 1.0.0 for download atm, have to understand what is wrong.
    Those vicious infected plugins have crashed my server more times than I care to count and with that version it permanently reduces all damage taken as long as the charger is alive which would basicly make him invulnerable permanently. I just meant maybe a damage reduction for the first pound in the same sense that bot chargers take less damage while charging but players don't ( what was valve thinking here? ) just instead being applies to the first time a charger pumbles a survivor. But thank you for trying. Might put out a request in the request section later on.
    theproperson is offline
    Lux
    Veteran Member
    Join Date: Jan 2015
    Location: Cat
    Old 07-22-2019 , 23:29   Re: [L4D] L4DNoSmoking (v1.0.1, 2019-07-21)
    Reply With Quote #8

    It is a good idea to use new syntax, if you wish to use new add this directive
    PHP Code:
    #pragma newdecls required 
    will bust your ass and not compile as it forces you to use new syntax.



    Below i thought i would show you a better way of writing it removing what you don't need from how i understand your code, this could just break your whole thing.

    PHP Code:
    public void tongue_grab(Event event, const char[] namebool dontBroadcast)// don't need action since you are not changing the event
    {
        
    int victim GetClientOfUserId(GetEventInt(event"victim"));
        if(!
    IS_VALID_SURVIVOR(victim))
            return;
        
        
    int id GetClientOfUserId(GetEventInt(event"userid"));

        if (
    IS_INFECTED_ALIVE(id))
        {
            for (
    int i 1<= MaxClientsi++) 
            { 
                if (
    IS_VALID_SURVIVOR(i) && != victim)// ignore the survivor getting smoked
                
    {
                    if(!
    IsPlayerAlive(i))
                    {
                        continue;
                    }
                    
                    if (
    l4dver == 1)
                    {
                        if (
    IsClientIncapacitatedl4d1(i) == false)
                        {
                            return;
                        }
                    }
                    else
                    {
                        if (
    IsClientIncapacitatedl4d2(i) == false)
                        {
                            return;
    // no need to do anything if a survivor is up and about and no need to continue looping
                        
    }
                    }
                    
                }
            }
            
            switch(
    GetConVarInt(cvar_killorslap))// just get the val when you need
            
    {
                case 
    1:
                
    PerformKill(idGetConVarInt(cvar_displaykillmessage));
                
                case 
    2:
                
    PerformSlap(idGetConVarInt(cvar_displaykillmessage));
            }    
        }
        return;
    }

    void PerformKill(int idint displaykillmessage)// 1 less param and does the same thing
    {
        
    ForcePlayerSuicide(id);
        switch (
    displaykillmessage)
        {
            case 
    1:
            
    PrintCenterTextAll("[SM] %N was socked for smoking last."id);// don't need to pass clientname %N does it for you when formatting Prints
            
            
    case 2:
            
    PrintHintTextToAll("[SM] %N was socked for smoking last."id);
            
            case 
    3:
            
    PrintToChatAll("\x01\x04[SM] \x03%N \x01was socked for smoking last."id);
        }
    }

    void PerformSlap(int idint displaykillmessage)
    {
        
    float vpos[3];
        
    GetEntPropVector(idProp_Data"m_vecOrigin"vpos);
        
    vpos[2] += 30.0// just use the same array you created do what you wish no need for creating 2
        
        
    TeleportEntity(idvposNULL_VECTORNULL_VECTOR);    
        switch (
    displaykillmessage)
        {
            case 
    1:
            
    PrintCenterTextAll("[SM] %N was slapped for smoking last."id);
            
            case 
    2:
            
    PrintHintTextToAll("[SM] %N was slapped for smoking last."id);
            
            case 
    3:
            
    PrintToChatAll("\x01\x04[SM] \x03%N \x01was slapped for smoking last."id);
        }

    Since you are using a switch for your different cvar options it's a good idea to clamp the cvar if someone were to set killorslap = 3 nothing would happen.
    PHP Code:
    cvar_killorslap CreateConVar("killorslap""1""1 kill smoker or 2 slap smoker"CVAR_FLAGStrue1.0true2.0); 
    With the new syntax you have classes or methods whichever you call them this is nothing to think about now but you can write code faster with them here a small example instead of nesting functions.

    PHP Code:
    int id GetClientOfUserId(GetEventInt(event"userid"));
    int id event.GetInt("userid")); 
    Does require you to use the event tag thingy
    e.g "Event event"
    PHP Code:
    public void tongue_grab(Event event, const char[] namebool dontBroadcast
    Spoiler
    __________________
    Connect
    My Plugins: KlickME
    [My GitHub]

    Commission me for L4D

    Last edited by Lux; 07-22-2019 at 23:35.
    Lux is offline
    finishlast
    Senior Member
    Join Date: Nov 2018
    Location: In Reno with the vitamin
    Old 07-23-2019 , 06:05   Re: [L4D] L4DNoSmoking (v1.0.0, 2019-07-22)
    Reply With Quote #9

    That looks very good and gets rid of a lot of useless variables.

    You did:

    Code:
    cvar_killorslap = CreateConVar("killorslap", "1", "1 kill smoker or 2 slap smoker", CVAR_FLAGS, true, 1.0, true, 2.0);
    Does it mean 1-2 is valid or explicit 1 and 2 is valid, not the range 1-2?

    When using it on the displaykillmessage with 0-3 would it be:
    Code:
    CreateConVar("displaykillmessage", "3", " 0 - Disabled; 1 - small HUD Hint; 2 - big HUD Hint; 3 - Chat Notification ", CVAR_FLAGS, true, 0.0, true, 3.0);
    ???

    I think when you have a plugin that allows multiple smoker or when you zspawn them, the plugin would fail to detect that, right? I could just let out the victim check then?

    Code:
                if (IS_VALID_SURVIVOR(i) && i != victim)// ignore the survivor getting smoked
    I combined your code and parts from Aya Supay. Atm I get an error in the log stating this:

    Code:
    L 07/23/2019 - 11:42:25: [SM] Blaming: L4DNoSmoking1.0.4.smx
    L 07/23/2019 - 11:42:25: [SM] Call stack trace:
    L 07/23/2019 - 11:42:25: [SM]   [0] VFormat
    L 07/23/2019 - 11:42:25: [SM]   [1] Line 236, L4DNoSmoking1.0.4.sp::CPrintToChatAll
    L 07/23/2019 - 11:42:25: [SM]   [2] Line 173, L4DNoSmoking1.0.4.sp::PerformSlap
    L 07/23/2019 - 11:42:25: [SM]   [3] Line 129, L4DNoSmoking1.0.4.sp::tongue_grab
    L 07/23/2019 - 11:42:57: [SM] Exception reported: Client index 1413564483 is invalid (arg 2)

    Last edited by finishlast; 07-24-2019 at 11:21.
    finishlast is offline
    Aya Supay
    Member
    Join Date: Nov 2015
    Old 07-23-2019 , 10:41   Re: [L4D] L4DNoSmoking (v1.0.0, 2019-07-22)
    Reply With Quote #10

    here the code
    Attached Files
    File Type: sp Get Plugin or Get Source (L4DNoSmoking.sp - 548 views - 10.0 KB)
    File Type: txt l4d_nosmoking.phrases.txt (1.4 KB, 227 views)

    Last edited by Aya Supay; 07-23-2019 at 12:27.
    Aya Supay 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 14:42.


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