Raised This Month: $ Target: $400
 0% 

How to catch the "MIC" event ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 04-06-2009 , 07:51   Re: How to catch the "MIC" event ?
Reply With Quote #1

PHP Code:
register_clcmd("+voicerecord""voice_on", -1);
register_clcmd("-voicerecord""voice_off", -1); 
__________________
minimiller is offline
Send a message via MSN to minimiller
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-06-2009 , 16:31   Re: How to catch the "MIC" event ?
Reply With Quote #2

You cannot hook [+/-] commands from the games unless they aren't standard.

Here is how you catch it:
Code:
#include <engine> #include <fakemeta> new sv_alltalk; public plugin_init() {     register_forward(FM_Voice_SetClientListening, "FwdSetVoice");         sv_alltalk = get_cvar_pointer("sv_alltalk"); } public FwdSetVoice(receiver, sender, listen) {     if( receiver == sender     || !is_user_connected(receiver)     || !is_user_connected(sender) ) return FMRES_IGNORED;         new senSpeak = get_speak(sender);         if( senSpeak == SPEAK_MUTED ) return FMRES_IGNORED;         new recSpeak = get_speak(receiver);         if( recSpeak == SPEAK_LISTENALL     || senSpeak == SPEAK_ALL     || senSpeak == SPEAK_NORMAL && (            get_pcvar_num(sv_alltalk)         || get_user_team(receiver) == get_user_team(sender) && (                is_user_alive(sender)             || !is_user_alive(receiver)             )         )     )     {         // 'sender' is talking to 'receiver'     }         return FMRES_IGNORED; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 02:28.


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