ULX

Author Topic: Oddities, extra eyes requested  (Read 2965 times)

0 Members and 2 Guests are viewing this topic.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Oddities, extra eyes requested
« on: December 06, 2008, 10:14:47 PM »
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?


Code: [Select]
-- 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
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given