View Single Post
Author Message
ASKER_CZ
BANNED
Join Date: Nov 2016
Old 03-25-2017 , 17:27   [REQ] Can somebody edit this plugin please?
Reply With Quote #1

Hello, i found this MUTE ALL plugin and im asking, if can somebody edit it to more comfortable?

Now its configured like when you write !muteall, it shows in chat example [!muteall @dead or @alive or @all] (same with unmuteall) . And its pretty annoying . So im asking if can somebody make version, where you just write !muteall and will mute everybody?

CODE IS HERE : Please make it, im sure lot of people will appreciate it
PHP Code:
#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "2.0"

public Plugin:myinfo 
{
    
name "Mute All",
    
author "",
    
description "Mutes all players",
    
version PLUGIN_VERSION,
    
url ""
}

public 
OnPluginStart()
{
    
CreateConVar("sm_muteall_vers"PLUGIN_VERSION"MuteAll version"FCVAR_NOTIFY|FCVAR_PLUGIN|FCVAR_DONTRECORD);
    
    
RegAdminCmd("sm_muteall"Command_MuteAllADMFLAG_GENERIC"Mute all");
    
RegAdminCmd("sm_unmuteall"Command_UnmuteAllADMFLAG_GENERIC"Unmute all");
}

public 
Action:Command_MuteAll(clientargs)
{
    
///////////////////////////////////////////////////////
    //Test The arguments to make sure it is a valid command
    ///////////////////////////////////////////////////////
    
if (args 1)
    {
        
ReplyToCommand(client"[SM] Usage: sm_muteall <@dead or @alive or @all>");
        return 
Plugin_Handled;    
    }
    new 
caseNum;
    new 
String:szArg[65];
    
    
GetCmdArg(1szArgsizeof(szArg));
    
    
/////////////////////////////////////////////////
    //Set the appropriate case based on the arguments
    /////////////////////////////////////////////////
    
if(strcmp(szArg"@dead"false) == 0)
        
caseNum=0;
    else if(
strcmp(szArg"@alive"false) == 0)
        
caseNum=1;
    else if(
strcmp(szArg"@all"false) == 0)
        
caseNum=2;
    else 
        
caseNum=3;
    
    
/////////////////////////
    //Perform the actual task
    /////////////////////////
    
switch(caseNum)
    {
        case 
0
        {
            for (new 
1<= MaxClientsi++)
            {
                if (
IsClientInGame(i) && !IsFakeClient(i) && !IsPlayerAlive(i))
                {
                    if (!
CheckCommandAccess(i"sm_muteall"ADMFLAG_GENERIC))
                    {
                        
SetClientListeningFlags(iVOICE_MUTED);
                    }              
                }
            }
            
ShowActivity2(client"[SM]""%N muted dead players"client);
        }
        case 
1:
        {
            for (new 
1<= MaxClientsi++)
            {
                if (
IsClientInGame(i) && !IsFakeClient(i) && IsPlayerAlive(i))
                {
                    if (!
CheckCommandAccess(i"sm_muteall"ADMFLAG_GENERIC))
                    {
                        
SetClientListeningFlags(iVOICE_MUTED);
                    }              
                }
            }
            
ShowActivity2(client"[SM]""%N muted alive players"client);
        }
        case 
2:
        {
            for (new 
1<= MaxClientsi++)
            {
                if (
IsClientInGame(i) && !IsFakeClient(i))
                {
                    if (!
CheckCommandAccess(i"sm_muteall"ADMFLAG_GENERIC))
                    {
                        
SetClientListeningFlags(iVOICE_MUTED);
                    }              
                }
            }
            
ShowActivity2(client"[SM]""%N muted all players"client);
        }
        case 
3ReplyToCommand(client"[SM] Usage: sm_muteall <@dead or @alive or @all>"); 
    }
    return 
Plugin_Handled;
}

public 
Action:Command_UnmuteAll(clientargs)
{
    
///////////////////////////////////////////////////////
    //Test The arguments to make sure it is a valid command
    ///////////////////////////////////////////////////////
    
if (args 1)
    {
        
ReplyToCommand(client"[SM] Usage: sm_unmuteall <@dead or @alive or @all>");
        return 
Plugin_Handled;    
    }
    
    new 
caseNum;
    new 
String:szArg[65];
    
    
GetCmdArg(1szArgsizeof(szArg));
    
    
/////////////////////////////////////////////////
    //Set the appropriate case based on the arguments
    /////////////////////////////////////////////////
    
if(strcmp(szArg"@dead"false) == 0)
        
caseNum=0;
    else if(
strcmp(szArg"@alive"false) == 0)
        
caseNum=1;
    else if(
strcmp(szArg"@all"false) == 0)
        
caseNum=2;
    else 
        
caseNum=3;
    
    
/////////////////////////
    //Perform the actual task
    /////////////////////////
    
switch(caseNum)
    {
        case 
0:
        {
            for (new 
1<= MaxClientsi++)
            {
                if (
IsClientInGame(i) && !IsFakeClient(i) && !IsPlayerAlive(i))
                {
                    if (!
CheckCommandAccess(i"sm_unmuteall"ADMFLAG_GENERIC))
                    {
                        
SetClientListeningFlags(iVOICE_NORMAL);
                    }              
                }
            }
            
ShowActivity2(client"[SM]""%N unmuted dead players"client);
        }
        case 
1:
        {
            for (new 
1<= MaxClientsi++)
            {
                if (
IsClientInGame(i) && !IsFakeClient(i) && IsPlayerAlive(i))
                {
                    if (!
CheckCommandAccess(i"sm_unmuteall"ADMFLAG_GENERIC))
                    {
                        
SetClientListeningFlags(iVOICE_NORMAL);
                    }              
                }
            }
            
ShowActivity2(client"[SM]""%N unmuted alive players"client);
        }
        case 
2:
        {
            for (new 
1<= MaxClientsi++)
            {
                if (
IsClientInGame(i) && !IsFakeClient(i))
                {
                    if (!
CheckCommandAccess(i"sm_unmuteall"ADMFLAG_GENERIC))
                    {
                        
SetClientListeningFlags(iVOICE_NORMAL);
                    }              
                }
            }
            
ShowActivity2(client"[SM]""%N unmuted all players"client);
        }
        case 
3ReplyToCommand(client"[SM] Usage: sm_unmuteall <@dead or @alive or @all>");
    }
    return 
Plugin_Handled;

ASKER_CZ is offline