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

how to make a whole plugin silent


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Leetbix
Member
Join Date: Dec 2009
Old 12-12-2009 , 22:20   how to make a whole plugin silent
Reply With Quote #1

how to make a whole plugin silent that is no chat triggers like [SM] Muted (client) when you type sm_mute (client) on plugin start i only want chat triggers when i typ PrintChatTAll. And also i do not want to edit my sourcemod.cfg or core.cfg is there a command to implement to the script? any help would be thanked alot
Leetbix is offline
Bigbuck
Senior Member
Join Date: Jul 2009
Old 12-12-2009 , 23:19   Re: how to make a whole plugin silent
Reply With Quote #2

You would need to remove the FLAG_NOTIFY from any CVARS you don't want to hear from.
Bigbuck is offline
Leetbix
Member
Join Date: Dec 2009
Old 12-12-2009 , 23:49   Re: how to make a whole plugin silent
Reply With Quote #3

Quote:
Originally Posted by Bigbuck View Post
You would need to remove the FLAG_NOTIFY from any CVARS you don't want to hear from.
how would i do it here?
\
PHP Code:
#include <sdktools>

new bool:mute;

public 
OnPluginStart()
{
    
LogMessage("[SM] Leetbix | 1337 Mute Terrorist System Started");
    
    
HookEvent("player_team"EventPlayerTeam);
    
HookEvent("player_spawn"EventPlayerSpawn);
}

public 
EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    
ServerCommand("sm_mute @t");
    
PrintToChatAll("[SM] Terrorists Muted For 60 Seconds");
    
CreateTimer(60.0Unmuted_Terrorists);
    
mute true;
}

public 
Action:Unmuted_Terrorists(Handle:timer)
{
    
ServerCommand("sm_unmute @t");
    
PrintToChatAll("[SM] Terrorists Have Been Unmuted");
    
mute false;
}

public 
EventPlayerTeam(Handle:event,const String:name[],bool:dontBroadcast)
{
    if (
mute == true)
    {
        new 
client GetClientOfUserId(GetEventInt(event,"userid"));
        new 
team GetEventInt(event"team");
        if (
team == 2)
        {
            
SetClientListeningFlags(clientVOICE_MUTED);
        }
    }

Leetbix is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 12-13-2009 , 00:43   Re: how to make a whole plugin silent
Reply With Quote #4

Change the value of sm_showactivity in cfg/sourcemod/sourcemod.cfg
pheadxdll is offline
Leetbix
Member
Join Date: Dec 2009
Old 12-13-2009 , 02:28   Re: how to make a whole plugin silent
Reply With Quote #5

Quote:
Originally Posted by pheadxdll View Post
Change the value of sm_showactivity in cfg/sourcemod/sourcemod.cfg
Maybe i did not clarify in my first post. I don't want to edit anything but the plugin itself. Is there any command?
Leetbix is offline
anon666
Member
Join Date: Apr 2009
Location: south east asia
Old 12-13-2009 , 03:48   Re: how to make a whole plugin silent
Reply With Quote #6

remove all PrintToChatAll lines if you insist going that way
anon666 is offline
Kevin_b_er
SourceMod Donor
Join Date: Feb 2009
Old 12-13-2009 , 14:46   Re: how to make a whole plugin silent
Reply With Quote #7

You'll need to change the plugin to not use servercommand, which reports based on sm_show_activity.

Here's modified versions of gag.sp's PerformMute and PerformUnMute. These used to contain LogAction() calls, but those are removed. You'll note client has also been removed, because we don't need to log or report to the users who did the mute/unmute call (the server/the "Console").

I modified them to only do the muting/unmuting.

You must call it for each client to mute/unmute them.


Original:
Code:
PerformMute(client, target)
{
    g_Muted[target] = true;
    SetClientListeningFlags(target, VOICE_MUTED);    
    LogAction(client, target, "\"%L\" muted \"%L\"", client, target);
}

PerformUnMute(client, target)
{
    g_Muted[target] = false;
    if (GetConVarInt(g_Cvar_Deadtalk) == 1 && !IsPlayerAlive(target))
    {
        SetClientListeningFlags(target, VOICE_LISTENALL);
    }
    else if (GetConVarInt(g_Cvar_Deadtalk) == 2 && !IsPlayerAlive(target))
    {
        SetClientListeningFlags(target, VOICE_TEAM);
    }
    else
    {
        SetClientListeningFlags(target, VOICE_NORMAL);
    }
    
    LogAction(client, target, "\"%L\" unmuted \"%L\"", client, target);
}
Modified:
Code:
PerformMute(target)
{
    SetClientListeningFlags(target, VOICE_MUTED);    
}

PerformUnMute(target)
{
    if (GetConVarInt(g_Cvar_Deadtalk) == 1 && !IsPlayerAlive(target))
    {
        SetClientListeningFlags(target, VOICE_LISTENALL);
    }
    else if (GetConVarInt(g_Cvar_Deadtalk) == 2 && !IsPlayerAlive(target))
    {
        SetClientListeningFlags(target, VOICE_TEAM);
    }
    else
    {
        SetClientListeningFlags(target, VOICE_NORMAL);
    }   
}
As per licensing, the modified versions of these functions are also licensed under GPLv3. Refer to gag.sp, included with sourcemod for more information on this.
Kevin_b_er is offline
Leetbix
Member
Join Date: Dec 2009
Old 12-14-2009 , 05:02   Re: how to make a whole plugin silent
Reply With Quote #8

Quote:
Originally Posted by Kevin_b_er View Post
You'll need to change the plugin to not use servercommand, which reports based on sm_show_activity.

Here's modified versions of gag.sp's PerformMute and PerformUnMute. These used to contain LogAction() calls, but those are removed. You'll note client has also been removed, because we don't need to log or report to the users who did the mute/unmute call (the server/the "Console").

I modified them to only do the muting/unmuting.

You must call it for each client to mute/unmute them.


Original:
Code:
PerformMute(client, target)
{
    g_Muted[target] = true;
    SetClientListeningFlags(target, VOICE_MUTED);    
    LogAction(client, target, "\"%L\" muted \"%L\"", client, target);
}

PerformUnMute(client, target)
{
    g_Muted[target] = false;
    if (GetConVarInt(g_Cvar_Deadtalk) == 1 && !IsPlayerAlive(target))
    {
        SetClientListeningFlags(target, VOICE_LISTENALL);
    }
    else if (GetConVarInt(g_Cvar_Deadtalk) == 2 && !IsPlayerAlive(target))
    {
        SetClientListeningFlags(target, VOICE_TEAM);
    }
    else
    {
        SetClientListeningFlags(target, VOICE_NORMAL);
    }
    
    LogAction(client, target, "\"%L\" unmuted \"%L\"", client, target);
}
Modified:
Code:
PerformMute(target)
{
    SetClientListeningFlags(target, VOICE_MUTED);    
}

PerformUnMute(target)
{
    if (GetConVarInt(g_Cvar_Deadtalk) == 1 && !IsPlayerAlive(target))
    {
        SetClientListeningFlags(target, VOICE_LISTENALL);
    }
    else if (GetConVarInt(g_Cvar_Deadtalk) == 2 && !IsPlayerAlive(target))
    {
        SetClientListeningFlags(target, VOICE_TEAM);
    }
    else
    {
        SetClientListeningFlags(target, VOICE_NORMAL);
    }   
}
As per licensing, the modified versions of these functions are also licensed under GPLv3. Refer to gag.sp, included with sourcemod for more information on this.

Can that mute a whole team, i want it to mute Terrorists...
Leetbix is offline
Kevin_b_er
SourceMod Donor
Join Date: Feb 2009
Old 12-14-2009 , 21:29   Re: how to make a whole plugin silent
Reply With Quote #9

It [un]mutes one person at a time. It shouldn't be too hard for you to find out who's on which team.
Kevin_b_er 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 12:56.


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