Raised This Month: $ Target: $400
 0% 

Boolean delay (wait 2 seconds before false in case it gets true again)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fatal_nl
Member
Join Date: Apr 2017
Old 08-07-2018 , 21:08   Re: Boolean delay (wait 2 seconds before false in case it gets true again)
Reply With Quote #1

I think this plugin needs some explanation first:

The plugin sets all talk on. FM_Voice_SetClientListening handles +voicerecord and -voicerecord. Only alive players can talk. Dead players can only listen (to prevent ghosting). Dead players are getting a HUD message when they try to talk with the VTC_OnClientStartSpeak function (that doesn't need a forward).

Admins can talk to each other with +adminvoice bind to a key. This is part of amx_super-serious.amxx. Luckily the FM_Voice_SetClientListening function doesn't interfere with this. Admins are still able to talk to each other while dead. However the VTC_OnClientStartSpeak function also get triggered when +adminvoice is used (they can still talk as it is supposed).

To hide the HUD message I added to +adminvoice clcmd to a function to set it true and clcmd -adminvoice to another command to make it false so I was able to determine when or when not printing the HUD message. Only problem is: as soon it get false (accidentally release mic key) and instantly true again (or after the 2 seconds in the code above) it prints the HUD message. Almost all admins have the habit to do that..

I'm using PLUGIN_CONTINUE instead of PLUGIN_HANDLED for the parts + or -adminvoice needs to re-used in amx_super-serious.amxx.

Everything would be more easy if I was able to catch the +voicerecord event (set true and false for +adminvoice) but as far as I know that's not possible without using the Orpheu module. I am using reAPI/ReHLDS* for other plugins as well so I'm unable to install that module.

* This is maybe a red flag for moderators but not everyone is using Reunion.

Edit:

Is this possible: keep g_bAdminVoice in function AdminVoiceOff true for 5 seconds before setting to false. If it becomes true again withing these 5 seconds in AdminVoiceOn reset this timer and don't let it become false until the full 5 seconds expire.

Last edited by fatal_nl; 08-07-2018 at 21:58.
fatal_nl 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 12:44.


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