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

[L4D1/2] Vocalize Fatigue 2


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Mr. Zero
Veteran Member
Join Date: Jun 2009
Location: Denmark
Plugin ID:
2231
Plugin Version:
2.1.0
Plugin Category:
General Purpose
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    13 
    Plugin Description:
    Adds fatigue to the vocalize command.
    Old 02-17-2011 , 18:01   [L4D1/2] Vocalize Fatigue 2
    Reply With Quote #1

    This plugin is now deprecated. Check out Scene Processor for an updated plugin.

    Vocalize Fatigue 2

    About:
    Wow, long time ago I did Vocalize Fatigue huh? Anyway, here is the updated version I have been working on this past week.
    Playing on a 16 man coop server with at least 4 people that spam "vocalize playerdeath" drove me insane.

    As such I installed my old vocalize fatigue but soon realized it wasn't what I quite needed. Vocalize Fatigue 2 was born and came with more settings to further limiting vocalize spam.

    Description:
    Adds fatigue to the vocalize command.

    Commands:
    sm_vocgag - Vocalize gag a player. Admin flag B (General) required.
    sm_vocungag - Vocalize ungag a player. Admin flag B (General) required.
    vocalizescene - Allows vocalization of any scene. Admin flag N (Cheat) required

    Cvars:
    A configuration file will be automatically created upon first run, in /cfg/sourcemod/ called vocalizefatigue.cfg
    Code:
    // Sets the blacklist immunity level. 0 to disable immunity from blacklist.
    // -
    // Default: "0"
    vf_blacklist_immunity "0"
    
    // Sets the fatigue immunity level. 0 to disable immunity from fatigue.
    // -
    // Default: "0"
    vf_fatigue_immunity "0"
    
    // Sets the vocalize filter mode. 0 to use blacklist, 1 to use whitelist.
    // -
    // Default: "0"
    vf_filtermode "0"
    
    // Sets whether the vocalize command will accept all vocalizations and not just only from rosetta menus (L4D1 style).
    // -
    // Default: "1"
    vf_jailbreak "1"
    
    // Sets the whitelist immunity level. 0 to disable immunity from whitelist.
    // -
    // Default: "0"
    vf_whitelist_immunity "0"

    Changelog:
    Code:
    Version 2.1.0 - 01-03-2011
    + Added vf_jailbreak to restore original function of vocalize command.
    + Added vocalizescene command to allow vocalization of any scene.
    + Added natives and forwards for other plugins to use.
    ~ Fixed invalid memory access error.
    
    Version 2.0.0 - 17-02-2011
    Initial release
    Previous downloads:
    Version 2.0.0: Release: 22 - Source: 31


    This plugin is now deprecated. Check out Scene Processor for an updated plugin.
    Attached Files
    File Type: zip vocalizefatigue.zip (34.7 KB, 2305 views)
    File Type: zip vocalizefatigue_source.zip (868.0 KB, 1547 views)

    Last edited by Mr. Zero; 06-06-2014 at 01:05.
    Mr. Zero is offline
    Mr. Zero
    Veteran Member
    Join Date: Jun 2009
    Location: Denmark
    Old 02-17-2011 , 18:01   [L4D1/2] Vocalize Fatigue 2: Plugins & FAQ
    Reply With Quote #2

    Plugins that uses Vocalize Fatigue:
    • Vocalize Warnigns
      Stops Survivors vocalizing warnings about specials that aint active.

    FAQ:
    Q: Whats the difference on the old Vocalize Fatigue and this new one?
    A: First of all, the old Vocalize Fatigue was my first plugin I wrote in SourcePawn. Since then I have learned a bunch of new stuff and got some better code comment manners (Looking at the old script, oh dear...).

    Secondly, besides this being a complete overhaul of the old script, this one will be support and I plan to add more stuff to it as I see fit.
    It also now supports fatigue time depending on the vocalization!

    Q: I noticed there is not any blacklist cvar anymore. How do I blacklist vocalize commands now?
    A: This have been moved to a filter file. The location of this file is "/addons/sourcemod/configs/vocalizefatigue/blacklist.cfg".
    In this file you simple write in the vocalize command you want to block and set filter mode to blacklist.

    Q: Filter mode? Whats that?
    A: Its simply the filter mode cvar. If 0 the blacklist filter file will be used, if 1 then the whitelist filter file will be used.

    Q: Where is the repeat and spam limits? No limit anymore?
    A: There is still a limit. However its now different for each vocalize command.
    This can be changed in the fatigue config file. Default locaiton:
    "/addons/sourcemod/configs/vocalizefatigue/fatigue.cfg".

    For example a player vocalize PlayerLaugth. In the fatigue config file, this adds a fatigue of 10 seconds. That means for 10 seconds the player is unable to vocalize again.

    Q: Whitelisting, is this possible?
    A: Yes. Like blacklist, you will have to set the filter mode cvar to whitelist and then you can change the whitelist config file in:
    "/addons/sourcemod/configs/vocalizefatigue/whitelist.cfg".

    Q: Do you offer any API, natives or forwards for other plugins to use?
    A: Yes, see post 3.

    Q: Where can I find vocalize commands? / Is there a list of vocalize strings?
    A: A good list can be found on the Steam forums. I'm pretty sure there are many lists out there. Google!

    Last edited by Mr. Zero; 03-18-2011 at 09:32.
    Mr. Zero is offline
    Mr. Zero
    Veteran Member
    Join Date: Jun 2009
    Location: Denmark
    Old 02-17-2011 , 18:02   [L4D1/2] Vocalize Fatigue 2
    Reply With Quote #3

    How to use filter config files:

    Vocalize Fatigue supports two filter modes; blacklist or whitelist.

    With blacklist, all vocalizations that are defined in the blacklist filter file, will be blocked from usage while all other vocalizations are allowed.
    Whitelist of course works the other way around, all vocalizations defined in whitelist will be allowed while anything else will be blocked.

    Using those files you can control exactly what vocalizations are allowed on your server.

    How to use the filter files is quite simple. Each line in the file represents a vocalize string. So for example in the blacklist you would have this:

    Code:
    // Comments starts with two forward slashes
    PlayerDeath
    PlayerUseAdrenaline // Inlined comments are also allowed
    That was players are no longer allowed to use those 2 vocalizations. And that is pretty much it.
    Then you just change the filter mode cvar to choose which one you want active. I personally recommend the whitelist mode.

    How to use fatigue config file:

    Instead of the old Vocalize Fatigue where it would simply capture the vocalize command and block if the player called it too often, in this version we add fatigue to the player after using a vocalization.
    In other words after a player have vocalized, he will suffer from fatigue from that vocalization.

    For example, lets say the vocalization PlayerLaugh have a fatigue of 10 seconds. After a player have vocalize PlayerLaugh they would be unable to vocalize for another 10 seconds.
    Each vocalization have it's own fatigue (if not default fatigue will be applied).

    To add vocalize fatigue to a vocalization you simply type the vocalize string, add a semicolon and then how many seconds. As from the example above, here is how it would look in the fatigue config file:

    Code:
    PlayerLaugh:10.0
    Now the player have to wait 10 seconds between each laugh.
    You can use 1.0, 0.67 or 3842.399 seconds. It's really up to you how much fatigue you want to apply.
    I have already included the fatigue config file and added fatigue for vocalizations as I deemed fitting, but don't be afraid of poke around and change them.

    Natives and Forwards (as of version 2.1.0)

    So with version 2.1.0 Vocalize Fatigue offers natives and forwards for other plugins to use.

    The include file is both in the release and source package. However just for good manner here is the list.

    Include file:
    PHP Code:
    /**
     * @brief Called on a client vocalizes.
     *
     * @param client        Client index doing the vocalization.
     * @param vocalize        Vocalize string, always lower case.
     * @param byPlugin        Whether it was initialized by a plugin.
     * @return                Plugin_Handled to stop vocalization, anything else to 
     *                        allow vocalization.
     */
    forward Action:L4D_OnClientVocalize(client, const String:vocalize[], bool:byPlugin);

    /**
     * @brief Called on post client vocalization.
     *
     * @param client        Client index that did the vocalization.
     * @param vocalize        Vocalize string, always lower case.
     * @param byPlugin        Whether it was initialized by a plugin.
     * @noreturn
     */
    forward L4D_OnClientVocalize_Post(client, const String:vocalize[], bool:byPlugin);

    /**
     * @brief Makes the client vocalize.
     * @remarks This will mark the vocalization as initialized by a plugin.
     *
     * @param client        Client index that will do the vocalization.
     * @param vocalize        Vocalize string, case insensitive.
     * @noreturn
     */
    native L4D_MakeClientVocalize(client, const String:vocalize[]);

    /**
     * @brief Makes the client vocalize.
     * @remarks This will not mark the vocalization as initialized by a plugin.
     *            Therefore it will be subject to normal filters.
     *
     * @param client        Client index that will do the vocalization.
     * @param vocalize        Vocalize string, case insensitive.
     * @noreturn
     */
    native L4D_MakeClientVocalizeEx(client, const String:vocalize[]);

    /**
     * @brief Forces a client to vocalize a certain scene.
     *
     * @param client        Client index that will do the vocalization.
     * @param scene            Scene name.
     * @noreturn
     */
    native L4D_MakeClientVocalizeScene(client, const String:scene[]); 
    Using the forwards and natives above you can control pretty much all vocalization that are initialized by players.

    In this post I will show off 3 example scripts. Remember these are example, so don't use them for your server. They are for playing with, not for a real server environment.

    Anyway.

    Example Plugin 1: I feel funny...

    This plugin makes the Survivor laugh for a bit after having eating pills. Seems those pills come with a side effect. You can't stop laughing for some reason.

    PHP Code:
    #include <sourcemod>
    #include "vocalizefatigue"

    static    const             MAX_FUNNY_TICKS 10;
    static            
    bool:    g_bFeelingFunny[MAXPLAYERS 1];
    static            
    Handle:    g_hTimer[MAXPLAYERS 1];
    static                    
    g_iTicks[MAXPLAYERS 1];

    public 
    Plugin:myinfo 
    {
        
    name "I feel funny...",
        
    author "Mr. Zero",
        
    description "... ha-ha funny",
        
    version "1.0",
        
    url "[email protected]"
    }

    public 
    OnPluginStart()
    {
        
    HookEvent("pills_used"OnPillsUsed_Event);
    }

    public 
    OnClientDisconnect(client)
    {
        
    g_bFeelingFunny[client] = false;
    }

    public 
    OnPillsUsed_Event(Handle:event, const String:name[], bool:dontBroadcast)
    {
        new 
    client GetClientOfUserId(GetEventInt(event"userid"));
        if (
    client == || !IsClientInGame(client)) return;

        if (
    g_bFeelingFunny[client])
        {
            
    CloseHandle(g_hTimer[client]);
        }
        
    g_bFeelingFunny[client] = true;
        
    g_iTicks[client] = 0;
        
    g_hTimer[client] = CreateTimer(2.0Drug_TimerclientTIMER_REPEAT);
    }

    public 
    Action:Drug_Timer(Handle:timerany:client)
    {
        if (!
    IsClientInGame(client))
        {
            
    g_bFeelingFunny[client] = false;
            return 
    Plugin_Stop;
        }

        
    g_iTicks[client]++;
        if (
    g_iTicks[client] > MAX_FUNNY_TICKS)
        {
            
    g_bFeelingFunny[client] = false;
            return 
    Plugin_Stop;
        }

        new 
    luck GetRandomInt(010);
        if (
    luck 7)
        {
            return 
    Plugin_Continue;
        }

        
    L4D_MakeClientVocalize(client"playerlaugh");

        return 
    Plugin_Continue;

    This will cause a Survivor to laugh randomly after eating some pills for about 20 seconds.
    Next time make sure to read the description before eat ALL of the pills in the bottle!

    Example plugin 2: Death to deathscreamers!

    I'm sure you hate death screaming as much as I do. So why not make the death scream a truly scream of death?

    PHP Code:
    #include <sourcemod>
    #include <sdktools>
    #include "vocalizefatigue"

    public Plugin:myinfo 
    {
        
    name "Death to death screamers",
        
    author "Mr. Zero",
        
    description "Nope.",
        
    version "1.0",
        
    url "[email protected]"
    }

    public 
    OnPluginStart()
    {
        
    /* */
    }

    public 
    Action:L4D_OnClientVocalize(client, const String:vocalize[], bool:byPlugin)
    {
        if (
    byPlugin) return Plugin_Continue// We only punish the client if they called it them self

        
    if (StrEqual(vocalize"playerdeath"))
        {
            
    SetEntityHealth(client1);
            
    decl Float:newVel[3];
            
    newVel[0] = GetRandomFloat(50.0150.0);
            
    newVel[1] = GetRandomFloat(50.0150.0);
            
    newVel[2] = 700.0;
            
    TeleportEntity(clientNULL_VECTORNULL_VECTORnewVel);

            
    L4D_MakeClientVocalize(client"playerno");
            return 
    Plugin_Handled;
        }

        return 
    Plugin_Continue;

    This will launch death screams into the air while setting their health to 1. That should learn them to not to death scream!

    Enjoy your flight.

    Example plugin 3: Vocalize chat triggers

    This simply hooks chat and make the Survivors vocalize what the client typed in chat.

    PHP Code:
    #include <sourcemod>
    #include "vocalizefatigue"

    public Plugin:myinfo 
    {
        
    name "Vocalize Chat Triggers",
        
    author "Mr. Zero",
        
    description "Chat triggers for vocalization",
        
    version "1.0",
        
    url "[email protected]"
    }

    public 
    OnPluginStart()
    {
        
    HookEvent("player_say"OnPlayerSay_Event);
    }

    public 
    OnPlayerSay_Event(Handle:event, const String:name[], bool:dontBroadcast)
    {
        new 
    client GetClientOfUserId(GetEventInt(event"userid"));
        if (
    client == || !IsClientInGame(client)) return;

        
    decl String:buffer[128];
        
    GetEventString(event"text"buffersizeof(buffer));
        if (
    StrContains(buffer"thanks"false) != -||
            
    StrContains(buffer"thank you"false) != -||
            
    StrContains(buffer"thx"false) != -1)
        {
            
    L4D_MakeClientVocalize(client"playerthanks");
            return;
        }

        if (
    StrContains(buffer"sorry"false) != -||
            
    StrContains(buffer"sry"false) != -1)
        {
            
    L4D_MakeClientVocalize(client"playersorry");
            return;
        }

        if (
    StrContains(buffer"!buy"false) != -1)
        {
            
    L4D_MakeClientVocalize(client"playertaunt");
            return;
        }

    For example when the player says sorry in chat, the survivor will vocalize it too.

    Feel free to suggest changes or other natives if you happen to need it ;3

    Last edited by Mr. Zero; 03-03-2011 at 20:00.
    Mr. Zero is offline
    siangc
    Senior Member
    Join Date: Mar 2010
    Old 02-20-2011 , 06:08   Re: [L4D2] Vocalize Fatigue 2
    Reply With Quote #4

    Good job, getting a few errors however.

    L 02/20/2011 - 00:21:29: SourceMod error session started
    L 02/20/2011 - 00:21:29: Info (map "c1m1_hotel") (file "errors_20110220.log")
    L 02/20/2011 - 00:21:29: [SM] Plugin encountered error 11: Invalid memory access
    L 02/20/2011 - 00:21:29: [SM] Displaying call stack trace for plugin "vocalizefatigue.smx":
    L 02/20/2011 - 00:21:29: [SM] [0] Line 395, helpers.sp::StringToLower()
    L 02/20/2011 - 00:21:29: [SM] [1] Line 206, whitelist.sp::ReadVocalizeWhitelistToTrie()
    L 02/20/2011 - 00:21:29: [SM] [2] Line 68, whitelist.sp::_Whitelist_OnPluginStart()
    L 02/20/2011 - 00:21:29: [SM] [3] Line 130, main.sp::OnPluginStart()
    L 02/20/2011 - 00:21:29: [SM] Plugin encountered error 25: Call was aborted
    L 02/20/2011 - 00:21:29: [SM] Native "ThrowError" reported: Your Left4Downtown Extension (0.5.2.2) is out of date, please upgrade to 0.5.2.3 or later
    L 02/20/2011 - 00:21:29: [SM] Displaying call stack trace for plugin "l4d2scores.smx":
    L 02/20/2011 - 00:21:29: [SM] [0] Line 2101, l4d2scores.sp::CheckDependencyVersions()
    L 02/20/2011 - 00:21:29: [SM] [1] Line 208, l4d2scores.sp::OnAllPluginsLoaded()
    L 02/20/2011 - 00:21:41: Error log file session closed.
    __________________
    siangc is offline
    AtomicStryker
    Veteran Member
    Join Date: Apr 2009
    Location: Teutonia!!
    Old 02-21-2011 , 06:38   Re: [L4D2] Vocalize Fatigue 2
    Reply With Quote #5

    Wow, this is ... incredibly elaborate for what it actually does. Have fun bug hunting, lol.


    I spotted some odd things in the code.. like:

    PHP Code:
    public Action:_Vocalize_OnVocalize_Command(client, const String:command[], argc)
    {
        if (
    client == CLIENT_INDEX_SERVER || IsFakeClient(client)) return Plugin_Continue;

        if (!
    IsClientInGame(client)) return Plugin_Handled
    Why check IsClientIngame after IsFakeClient? The first would error out already. Also, you block local servers from running this plugin. Do dedicated servers vocalize, at all?
    AtomicStryker is offline
    Mr. Zero
    Veteran Member
    Join Date: Jun 2009
    Location: Denmark
    Old 02-21-2011 , 08:50   Re: [L4D2] Vocalize Fatigue 2
    Reply With Quote #6

    Quote:
    Originally Posted by AtomicStryker View Post
    Wow, this is ... incredibly elaborate for what it actually does. Have fun bug hunting, lol.


    I spotted some odd things in the code.. like:

    PHP Code:
    public Action:_Vocalize_OnVocalize_Command(client, const String:command[], argc)
    {
        if (
    client == CLIENT_INDEX_SERVER || IsFakeClient(client)) return Plugin_Continue;

        if (!
    IsClientInGame(client)) return Plugin_Handled
    Why check IsClientIngame after IsFakeClient? The first would error out already. Also, you block local servers from running this plugin. Do dedicated servers vocalize, at all?
    Yeah... nice catch

    No the server doesn't vocalize, I don't block the command through. Even if there is a fool to do "rcon vocalize", I rather be safe than sorry.
    Mr. Zero is offline
    AtomicStryker
    Veteran Member
    Join Date: Apr 2009
    Location: Teutonia!!
    Old 02-21-2011 , 16:19   Re: [L4D2] Vocalize Fatigue 2
    Reply With Quote #7

    What would happen anyway? Nothing.
    AtomicStryker is offline
    ellis
    Senior Member
    Join Date: Apr 2010
    Old 02-24-2011 , 08:51   Re: [L4D2] Vocalize Fatigue 2
    Reply With Quote #8

    this is really a good plugin, against the annoying spam of vocalize thanks

    i have installed the plugin on my server and i become a startup error

    Code:
    L 02/24/2011 - 16:41:31: Info (map "c5m1_waterfront") (file "errors_20110224.log")
    L 02/24/2011 - 16:41:31: [SM] Plugin encountered error 11: Invalid memory access
    L 02/24/2011 - 16:41:31: [SM] Displaying call stack trace for plugin "vocalizefatigue.smx":
    L 02/24/2011 - 16:41:31: [SM]   [0]  Line 395, helpers.sp::StringToLower()
    L 02/24/2011 - 16:41:31: [SM]   [1]  Line 206, whitelist.sp::ReadVocalizeWhitelistToTrie()
    L 02/24/2011 - 16:41:31: [SM]   [2]  Line 68, whitelist.sp::_Whitelist_OnPluginStart()
    L 02/24/2011 - 16:41:31: [SM]   [3]  Line 130, main.sp::OnPluginStart()

    Last edited by ellis; 02-24-2011 at 10:45.
    ellis is offline
    λlsnana(H λ l f l i f e)
    Member
    Join Date: Jun 2010
    Old 02-25-2011 , 12:01   Re: [L4D2] Vocalize Fatigue 2
    Reply With Quote #9

    Quote:
    at least 4 people that spam "vocalize playerdeath" drove me insane.

    Wait they can vocalize? I thought you cant

    Or its a plugin that Enables it.
    λlsnana(H λ l f l i f e) is offline
    Send a message via MSN to λlsnana(H λ l f l i f e)
    Mr. Zero
    Veteran Member
    Join Date: Jun 2009
    Location: Denmark
    Old 03-01-2011 , 08:59   Re: [L4D2] Vocalize Fatigue 2
    Reply With Quote #10

    Good news everyone!

    The good ol' vocalize command as you know it is back! That means in L4D2 you can now bind and use the vocalize command as in L4D1.

    E.g. bind key "vocalize PlayerThanks" will now work.

    Thanks to Atomic to lead me the right way

    I also fixed the invalid memory access error and added vocalize scenes from Atomics tech demo.
    And for even more awesomeness natives and forwards for other plugins to use. I will provide a few examples in the next post of mine.
    Mr. Zero 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 08:58.


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