• Without inturrupting with voice chat radius
    7 replies, posted
So I have this code where Its meant to allow people to talk to each other regardless of distance. Trouble is, it works (The debugging message prints "Hi" just fine) but the voice radius still works. How can I make it so theres no voice radius in between these two players? [CODE]hook.Add("PlayerCanHearPlayersVoice", "talk to me now plz", function( plOne, plTwo ) if plOne.TalkingTo != nil and plTwo.TalkingTo != nil then if plOne.TalkingTo:UniqueID() == plTwo:UniqueID() or plTwo.TalkingTo:UniqueID() == plOne:UniqueID() then print("Hi") return true, true end end end) [/CODE] I should mention that Im using DarkRP if that makes a difference. Ps: I know I dont need the uniqueID there, that was just a testinmg
true, false [url]http://wiki.garrysmod.com/page/GM/PlayerCanHearPlayersVoice[/url]
Why use Unique id? Neither of the two players will ever have the same Unique ID(unless your talking to your self). So that code will never return true. If you can explain what your trying to do I can help you fix it. Edit: Didnt see the part about you using it for testing. But I still don't understand how you expect it to work.
[QUOTE=TheEmp;45398738]Why use Unique id? Neither of the two players will ever have the same Unique ID(unless your talking to your self). So that code will never return true. If you can explain what your trying to do I can help you fix it. Edit: Didnt see the part about you using it for testing. But I still don't understand how you expect it to work.[/QUOTE] I'm not 100% sure about this but I DO believe that this hook is (at least sometimes) called with both parameters being the same player. This hook in my gamemode checks if both players are the same.
Seems to work one way, at the moment I dont have somone else to test it with so Il update you on that tomorrow but it seems to work. Thanks!
I wouldn't use the bare #UniqueID function as it's a quite expensive and I'm unsure if it caches the result.
What? Why are we using UniqueID to check if both ents are the same? just do plOne == plTwo ?!
I know, like I said, I was testing something else (long story) . It works both ways now. Thanks, Vex!
Sorry, you need to Log In to post a reply to this thread.