View Single Post
B3none
AlliedModders Donor
Join Date: Oct 2016
Location: United Kingdom
Old 03-25-2017 , 21:47   Re: [REQ] Can somebody edit this plugin please?
Reply With Quote #7

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=2
     
    
///////////////////////// 
    //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=2
     
    
///////////////////////// 
    //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


How about this? I just changed the default swith case to be "@all"
__________________
B3none is offline