I'm trying to prevent HLSS or HLDJ players from using the voice_inputfromfile convar, yet still allow chat on servers (if the admin desires)
The code below, in theory to me, should work.
It doesn't.
The server host testing for me (and wanting this) says that any person who tries to use voice gets cut off, even if they aren't trying to play a sound.
No one can talk with the following running.
If I'm turning off "voice_inputfromfile", shouldn't it be false on the next check, and allow them to talk instead of cutting them off (-voicerecord) and returning true?
Two possibles I just thought of;
-Does anyone here know if HLSS and HLDJ force convar "voice_inputfromfile" to always be on, even if attempt to turn it off is done in console?
-If I'm returning true, could this be allowing other binds, such as those used for HLSS, to still enable the convar while of course still killing the voicerecord?
-Would returning false kill it?
-- Anti Noise/HLSS/DJ (or anti any other play sounds from mic input program) script.
-- This wasn't rocket science. Make it better if you want.
-- Original author JamminR/Team Ulysses.
--
if SERVER then
AddCSLuaFile ( "autorun/AntiNoise.lua" )
else
RunConsoleCommand( "voice_inputfromfile", "0" )
MsgN( "***AntiNoise Clause***> " .. GetConVarString( "name" ) .. ", you're playing on a non-HLSS/DJ/file through voicerecord server. Thanks." )
function ForceAnti_Noise( ply, bind )
if string.find( bind, "voicerecord" ) then
if GetConVarNumber( "voice_inputfromfile" ) then
RunConsoleCommand( "-voicerecord" )
RunConsoleCommand( "voice_inputfromfile", "0" )
return true
end
end
end
hook.Add( "PlayerBindPress", "Anti_HLSS", ForceAnti_Noise )
end