Raised This Month: $ Target: $400
 0% 

catching player using voice


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 03-13-2010 , 02:44   Re: catching player using voice
Reply With Quote #1

Quote:
Originally Posted by aaarnas View Post
Thats strange. get_user_info always returns me "voice_modenable" 0, what ever i set it.
You must use query_client_cvar to get correct value.
__________________
Impossible is Nothing
Sylwester is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 03-12-2010 , 10:33   Re: catching player using voice
Reply With Quote #2

I guess the only way to do that is to force people to use a custom voicerecord command (+startvoice) and implement at FM_Voice_SetClientListening your own control.

You have to block every voice communication for users not using that command.

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define get_bit(%1,%2)     ( %1 &   1 << ( %2 & 31 ) )
#define set_bit(%1,%2)    %1 |=  ( 1 << ( %2 & 31 ) )
#define clear_bit(%1,%2)    %1 &= ~( 1 << ( %2 & 31 ) )

new g_PlayerVoice

public plugin_init()
{
    
register_clcmd("+startvoice""player_startvoice_on")
    
register_clcmd("-startvoice""player_startvoice_off")

    
register_forward(FM_Voice_SetClientListenting"setclient_listening")
}

public 
player_startvoice_on(id)
{
    
set_bit(g_PlayerVoiceid)
    
client_cmd(id"+voicerecord")
    return 
PLUGIN_HANDLED
}

public 
player_startvoice_off(id)
{
    
clear_bit(g_PlayerVoiceid)
    
client_cmd(id"-voicerecord")
    return 
PLUGIN_HANDLED
}

public 
setclient_listening(receiversenderbool:listen)
{
    if(!
is_user_connected(receiver) || !is_user_connected(sender) || (receiver == sender)
      return 
FMRES_IGNORED

    
if(!get_big(g_PlayerVoicesender))
    {
        
engfunc(EngFunc_SetClientListeningreceiversenderfalse)    // Can't talk because is not using +startvoice
        
return PLUGIN_SUPERCEDE
    
}

/*
      put your code here
      you can modify bool:listen depending on what you want and then call SetClientListening + return SUPERCEDE

      To change behavior (mute, permit, etc)
          engfunc(EngFunc_SetClientListening, receiver, sender, listen)
          return FMRES_SUPERCEDE
*/

    
return FMRES_IGNORED

__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.

Last edited by joropito; 03-12-2010 at 10:36.
joropito is offline
Send a message via MSN to joropito
aaarnas
Veteran Member
Join Date: Jun 2008
Location: Lithuania
Old 03-20-2010 , 17:23   Re: catching player using voice
Reply With Quote #3

I managed how to make it. Thanks to all who helped
aaarnas is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 03-20-2010 , 17:59   Re: catching player using voice
Reply With Quote #4

Quote:
Originally Posted by aaarnas View Post
I managed how to make it. Thanks to all who helped
If you found a better way than my code, please share it with us.

Thanks.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
aaarnas
Veteran Member
Join Date: Jun 2008
Location: Lithuania
Old 03-21-2010 , 13:48   Re: catching player using voice
Reply With Quote #5

I used joropito way and binding players buttons witch players selected for use mic.
aaarnas 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 19:50.


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