Raised This Month: $ Target: $400
 0% 

allow specific user mic chatting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 12-16-2012 , 13:51   allow specific user mic chatting
Reply With Quote #1

Ok what i want to do is have a command (amx_allowmic <name> <state>) to either allow or disallow mic chatting. I have come this far, but for some reason this doesn't work. Any help is appreciated.

PHP Code:
new bool:g_bAllowMic33 ];

public 
plugin_init( ) {
    
register_forwardFM_Voice_SetClientListening,     "Forward_SetVoice" );
    
register_concmd"amx_allowmic",    "ConCmd_AllowMic",        ADMIN_ADMIN" <name|authid|userid> <1|0> - Set a player talk power" );
}

// Edit:
public client_putinserveriPlayerID ) {
    
g_bAllowMiciPlayerID ] = false;
}

public 
Forward_SetVoiceiReceiveriSenderbool:listen ) {
    if( !( 
1<= iReceiver <= g_iMaxPlayers ) ||
        !
g_bConnectediReceiver ] ||
        !( 
1<= iSender <= g_iMaxPlayers ) ||
        !
g_bConnectediSender ] ) {
        
        return 
FMRES_IGNORED;
    }
    
    new 
CsTeams:iTeam cs_get_user_teamiSender );
    
    if( !
g_bAllowMiciSender ] && !accessiSenderADMIN_KICK ) ) {
        
engfuncEngFunc_SetClientListeningiReceiveriSender);
        return 
FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;
}

public 
ConCmd_AllowMiciPlayerIDiLeveliCid ) {
    if( !
cmd_accessiPlayerIDiLeveliCid) ) {
        return 
PLUGIN_HANDLED;
    }
    
    static 
strTarget32 ], strStatus];
    
read_argv1strTarget31 );
    
read_argv2strStatus);
    
    new 
iTarget cmd_targetiPlayerIDstrTargetCMDTARGET_OBEY_IMMUNITY CMDTARGET_ALLOW_SELF );
    
    if( !
iTarget ) {
        return 
PLUGIN_HANDLED;
    }
    
    if( 
str_to_numstrStatus ) ) {
        
g_bAllowMiciTarget ] = true;
        
        
client_printiPlayerIDprint_console"Talk power has been granted to the user." );
    } else {
        
g_bAllowMiciTarget ] = false;
        
        
client_printiPlayerIDprint_console"Talk power has been revoked from the user." );
    }
    
    return 
PLUGIN_HANDLED;

Any ideas?

EDIT: when i use the command amx_allowmic, i get the appropriate message so i know that the bool value is correctly set, it's just that when he tries to talk it doesn't work (btw i reset the boolean value to false whenver a player connects)
__________________

Last edited by n0br41ner; 12-16-2012 at 13:58.
n0br41ner is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 12-16-2012 , 14:44   Re: allow specific user mic chatting
Reply With Quote #2

never min it works, in my case it wasn't working because i had other checks before the g_bAllowMic check and it was stopping it
__________________
n0br41ner 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 06:37.


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