Raised This Month: $32 Target: $400
 8% 

Mute after 5 seconds(callout)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bob1
Member
Join Date: Sep 2011
Location: Denmark
Old 02-18-2016 , 05:28   Mute after 5 seconds(callout)
Reply With Quote #1

What I want:
5 seconds after dying(the callout): mute the dead person for the alive people playing ... but not for dead people, they can have conversations.

If you have more time:
Admin priviliges so admins doesn't get muted (generic admin).

I have found this code, but does not have a timer in it, I tried have a timer on DeathEvent to another public ..., but didn't work as planned, it still instant muted after death, i want 5 seconds.

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

new Handle:Cvar_Deadtalk INVALID_HANDLE;
new 
Handle:Cvar_Sentinel INVALID_HANDLE;

#define PLUGIN_VERSION "1.0.104"

#define ADMIN_LEVEL          ADMFLAG_CHAT

public Plugin:myinfo =
{
   
name "Dead Alltalk",
   
author "<eVa>StrontiumDog/MMX.TVR",
   
description "Lets dead players chat with each other while the living play on",
   
version PLUGIN_VERSION,
   
url "http://www.theville.org"
};

public 
OnPluginStart()
{
   
CreateConVar("sm_deadalltalk_version"PLUGIN_VERSION"DeadAlltalk Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
   
Cvar_Deadtalk CreateConVar("sm_deadalltalk""1"" - when enabled, dead players can listen/chat to one another"FCVAR_PLUGIN);
   
Cvar_Sentinel FindConVar("sv_admin_sentinel_startup");
   }

public 
OnMapStart()
{
   
HookEvent("player_spawn"PlayerSpawnEvent);
   
HookEvent("player_death"PlayerDeathEvent);
}

public 
OnEventShutdown()
{
   
UnhookEvent("player_spawn"PlayerSpawnEvent);
   
UnhookEvent("player_death"PlayerDeathEvent);
}

public 
PlayerSpawnEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
!= GetConVarInt(Cvar_Deadtalk))
    {
        return;
    }
    
    new 
sourceClient GetClientOfUserId(GetEventInt(event"userid"));
    
    if ((
GetUserFlagBits(sourceClient) & ADMIN_LEVEL) && (Cvar_Sentinel != INVALID_HANDLE))
    {
        return;
    }
    
    for (new 
targetClient MaxClientstargetClienttargetClient--)
    {
        if (!
IsClientInGame(targetClient))
        {
            continue;
        }
        
        
SetClientListening(sourceClienttargetClientLISTEN_DEFAULT);
    
        if (
GetClientTeam(targetClient) == GetClientTeam(sourceClient))
        {
            continue;
        }
        
        
// Dead clients on opposite team can't hear respawned client
        
SetClientListening(targetClientsourceClientLISTEN_DEFAULT);
    }
}

public 
PlayerDeathEvent(Handle:event, const String:name[], bool:dontBroadcast)
{   
    if (
!= GetConVarInt(Cvar_Deadtalk))
    {
        return;
    }
    
    new 
sourceClient GetClientOfUserId(GetEventInt(event"userid"));
    
    if ((
GetUserFlagBits(sourceClient) & ADMIN_LEVEL) && (Cvar_Sentinel != INVALID_HANDLE))
    {
        return;
    }
    
    new 
sourceClientTeam GetClientTeam(sourceClient);
    
    for (new 
targetClient MaxClientstargetClienttargetClient--)
    {
        if (!
IsClientInGame(targetClient) || targetClient == sourceClient)
        {
            continue;
        }
        
        if (!
IsPlayerAlive(targetClient))
        {
            
// Dead players can hear dead client and vice versa
            
SetClientListening(targetClientsourceClientLISTEN_YES);
            
SetClientListening(sourceClienttargetClientLISTEN_YES);
        }
        
        if (
GetClientTeam(targetClient) == sourceClientTeam)
        {
            
// Client can listen to own team
            
SetClientListening(sourceClienttargetClientLISTEN_YES);
        }
    }

Can you help?
__________________
Mini-Scripter.

Last edited by Bob1; 02-18-2016 at 05:30.
Bob1 is offline
Addicted.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
Old 02-18-2016 , 11:58   Re: Mute after 5 seconds(callout)
Reply With Quote #2

Haven't tested this but here:

PHP Code:
#pragma semicolon 1 

#include <sourcemod> 
#include <sdktools> 

Handle Cvar_Deadtalk INVALID_HANDLE

#define PLUGIN_VERSION "1.0.104" 

#define ADMIN_LEVEL        ADMFLAG_CHAT 

public Plugin myinfo 

   
name "Dead Alltalk"
   
author "<eVa>StrontiumDog/MMX.TVR"
   
description "Lets dead players chat with each other while the living play on"
   
version PLUGIN_VERSION
   
url "http://www.theville.org" 
}; 

public 
void OnPluginStart() 

   
CreateConVar("sm_deadalltalk_version"PLUGIN_VERSION"DeadAlltalk Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); 
   
Cvar_Deadtalk CreateConVar("sm_deadalltalk""1"" - when enabled, dead players can listen/chat to one another"FCVAR_PLUGIN); 

   
HookEvent("player_spawn"Event_Spawn); 
   
HookEvent("player_death"Event_Death);    


public 
void Event_Spawn(Handle event, const char[] namebool dontBroadcast

    if (
GetConVarInt(Cvar_Deadtalk) != 1)
        return; 
     
    
int client GetClientOfUserId(GetEventInt(event"userid"));
     
    for (
int iMaxClientsi++) 
    {
        if (!
IsClientInGame(i)) 
            continue;

        
SetListenOverride(clientiListen_Default);
    } 


public 
Event_Death(Handle event, const char[] namebool dontBroadcast
{    
    if (
GetConVarInt(Cvar_Deadtalk) != 1)
        return;
     
    
int client GetClientOfUserId(GetEventInt(event"userid"));
     
    if (
CheckCommandAccess(client""ADMIN_LEVELtrue))
        return;

    
CreateTimer(5.0MuteForAliveclient);
     
    return;
}

public 
Action MuteForAlive(Handle timerany client)
{
    if (
IsPlayerAlive(client) || !IsClientConnected(client))
        return 
Plugin_Stop;
    
    for (
int iMaxClientsi++)
    {
        if (!
IsClientInGame(i) || == client
            continue; 

        if (!
IsPlayerAlive(i)) 
        { 
            
SetListenOverride(iclientListen_Yes);
            
SetListenOverride(clientiListen_Yes);
        }
    }

    
PrintToChat(client"Callout period expired, alive players can no longer hear you");
    
    return 
Plugin_Stop;

Addicted. is offline
Bob1
Member
Join Date: Sep 2011
Location: Denmark
Old 02-18-2016 , 13:56   Re: Mute after 5 seconds(callout)
Reply With Quote #3

Quote:
Originally Posted by oaaron99 View Post
Haven't tested this but here:

PHP Code:
#pragma semicolon 1 

#include <sourcemod> 
#include <sdktools> 

Handle Cvar_Deadtalk INVALID_HANDLE

#define PLUGIN_VERSION "1.0.104" 

#define ADMIN_LEVEL        ADMFLAG_CHAT 

public Plugin myinfo 

   
name "Dead Alltalk"
   
author "<eVa>StrontiumDog/MMX.TVR"
   
description "Lets dead players chat with each other while the living play on"
   
version PLUGIN_VERSION
   
url "http://www.theville.org" 
}; 

public 
void OnPluginStart() 

   
CreateConVar("sm_deadalltalk_version"PLUGIN_VERSION"DeadAlltalk Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); 
   
Cvar_Deadtalk CreateConVar("sm_deadalltalk""1"" - when enabled, dead players can listen/chat to one another"FCVAR_PLUGIN); 

   
HookEvent("player_spawn"Event_Spawn); 
   
HookEvent("player_death"Event_Death);    


public 
void Event_Spawn(Handle event, const char[] namebool dontBroadcast

    if (
GetConVarInt(Cvar_Deadtalk) != 1)
        return; 
     
    
int client GetClientOfUserId(GetEventInt(event"userid"));
     
    for (
int iMaxClientsi++) 
    {
        if (!
IsClientInGame(i)) 
            continue;

        
SetListenOverride(clientiListen_Default);
    } 


public 
Event_Death(Handle event, const char[] namebool dontBroadcast
{    
    if (
GetConVarInt(Cvar_Deadtalk) != 1)
        return;
     
    
int client GetClientOfUserId(GetEventInt(event"userid"));
     
    if (
CheckCommandAccess(client""ADMIN_LEVELtrue))
        return;

    
CreateTimer(5.0MuteForAliveclient);
     
    return;
}

public 
Action MuteForAlive(Handle timerany client)
{
    if (
IsPlayerAlive(client) || !IsClientConnected(client))
        return 
Plugin_Stop;
    
    for (
int iMaxClientsi++)
    {
        if (!
IsClientInGame(i) || == client
            continue; 

        if (!
IsPlayerAlive(i)) 
        { 
            
SetListenOverride(iclientListen_Yes);
            
SetListenOverride(clientiListen_Yes);
        }
    }

    
PrintToChat(client"Callout period expired, alive players can no longer hear you");
    
    return 
Plugin_Stop;

How should I define the errors : error 017: undefined symbol "SetListenOverride" ?
There three of them, identical.
EDIT: Nevermind, I got it working by compiling it from the webcompiler. I will test it out now and let you know.
__________________
Mini-Scripter.

Last edited by Bob1; 02-18-2016 at 14:01.
Bob1 is offline
Bob1
Member
Join Date: Sep 2011
Location: Denmark
Old 02-18-2016 , 14:14   Re: Mute after 5 seconds(callout)
Reply With Quote #4

Everything is working but the dying person can't talk for 5 seconds, it'll make it instant mute.
Dead can talk to dead, so that's working.
__________________
Mini-Scripter.
Bob1 is offline
Addicted.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
Old 02-18-2016 , 16:30   Re: Mute after 5 seconds(callout)
Reply With Quote #5

Make sure sv_deadtalk and sv_alltalk are set to 1
Addicted. is offline
napster_10
Senior Member
Join Date: May 2016
Old 06-18-2019 , 10:28   Re: Mute after 5 seconds(callout)
Reply With Quote #6

cant get this run. is this still working?
napster_10 is offline
Cruze
Veteran Member
Join Date: May 2017
Old 06-19-2019 , 00:50   Re: Mute after 5 seconds(callout)
Reply With Quote #7

Quote:
Originally Posted by napster_10 View Post
cant get this run. is this still working?
sv_talk_after_dying_time
__________________
Taking paid private requests! Contact me
Cruze is offline
napster_10
Senior Member
Join Date: May 2016
Old 06-19-2019 , 07:59   Re: Mute after 5 seconds(callout)
Reply With Quote #8

wow nice..can they talk to other dead people then?
napster_10 is offline
Cruze
Veteran Member
Join Date: May 2017
Old 06-19-2019 , 08:04   Re: Mute after 5 seconds(callout)
Reply With Quote #9

Quote:
Originally Posted by napster_10 View Post
wow nice..can they talk to other dead people then?
Haven't tried using this convar. Give it a go!
I think it should be dependent on sv_deadtalk
__________________
Taking paid private requests! Contact me
Cruze 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 00:21.


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