Thread: move to trash
View Single Post
Cruze
Veteran Member
Join Date: May 2017
Old 08-23-2019 , 12:47   Re: No Perm No Chat Sound
Reply With Quote #4

PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>
#include <clientprefs>

#define DD    "buttons/blip1.wav"

bool blocktext false;
Handle g_isEnabled INVALID_HANDLE;

public 
void OnPluginStart()
{
    
g_isEnabled CreateConVar("sm_saysound_enable""1""(1 = ON ; 0 = OFF)"0);

    
AddCommandListener(Command_Say"say");
    
    
blocktext false;
}

stock char RemoveSymbol(char[] buffer)
{   
    
char str[3];
    
char new_str[3];
    
int new_str_count 0;  
    
    
strcopy(str3buffer);   
   
    for (
int i 0len 2<leni++)
    {
        if ((
'!' == str[i]) || ('/' == str[i]))
        {
            
new_str[new_str_count] = str[i];
            
new_str_count++;
        }    
    }
    
strcopy(buffer3new_str);
    return 
buffer;
}

public 
Action Command_Say(int client, const char[] commandint args)  
{
    if(!
g_isEnabled) return Plugin_Stop;

    if (!
blocktext)
    {
        
blocktext true;
        
        
char isay[3];
        if (
GetCmdArgString(isaysizeof(isay)) >= 1)
        {
            
RemoveSymbol(isay);
            
//PrintToChatAll("%s", isay);
            
if ((isay[0] == '!')
            || (
isay[0] == '/'))            
            {
                
blocktext false;
                return 
Plugin_Stop;
            }
            if(
CheckCommandAccess(client""ADMFLAG_RESERVATION ADMFLAG_VOTE ADMFLAG_KICK))
                
EmitSoundToAll(DD);
        }
        
RequestFrame(UnblockText0);
    }
    return 
Plugin_Continue;
}

public 
void UnblockText(any idk)
{
    
blocktext false;

__________________
Taking paid private requests! Contact me
Cruze is offline