View Single Post
Mr. Zero
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 03-18-2011 , 09:28   Re: [L4D1/2] Vocalize Fatigue 2
Reply With Quote #13

Here is a little script of mine.

This stops Survivors from vocalizing about specials that ain't active. Such as Survivors screaming TANNNK! when hes not even spawned yet. Same with the Witch.

Only works on COOP.

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

public Plugin:myinfo 
{
    
name "Vocalize Warnings",
    
author "Mr. Zero",
    
description "Stops Survivors vocalizing warnings about specials that aint active.",
    
version "1.0",
    
url "http://forums.alliedmods.net/showthread.php?t=150357"
}

public 
OnPluginStart()
{
    
/* */
}

public 
Action:L4D_OnClientVocalize(client, const String:vocalize[], bool:byPlugin)
{
    if (
byPlugin) return Plugin_Continue// If client was asked to vocalize by a plugin, allow

    
if (StrEqual(vocalize"playeralsowarntank") || (StrEqual(vocalize"playerwarntank"))) // Player is trying to warn about a tank
    
{
        if (!
IsAnyTankAlive()) // If no tanks are alive
        
{
            return 
Plugin_Handled// Stop vocalization
        
}
    }

    if (
StrEqual(vocalize"playeralsowarnwitch") || (StrEqual(vocalize"playerwarnwitch"))) // Player is trying to warn about a witch
    
{
        if (!
IsAnyWitchAlive()) // If no witches are alive
        
{
            return 
Plugin_Handled// Stop vocalization
        
}
    }

    return 
Plugin_Continue// Allow vocalization
}

static 
bool:IsAnyTankAlive()
{
    
decl String:name[32];
    for (new 
client 1client <= MaxClientsclient++)
    {
        if (!
IsClientInGame(client) || !IsFakeClient(client)) continue;
        if (!
IsPlayerAlive(client) || GetClientHealth(client) < 1) continue;

        
GetClientName(clientname32);
        if (
StrContains(name"tank"false) != -1)
        {
            return 
true;
        }
    }
    return 
false;
}

static 
bool:IsAnyWitchAlive()
{
    return (
FindEntityByClassname(-1"witch") > 0);

Attached Files
File Type: smx vocalizewarnings.smx (2.8 KB, 317 views)
Mr. Zero is offline