VC_MAX_RADIUS = 120
timer.Create( “VoiceChatRadius”, 1, 0, function()
local lpl = LocalPlayer();
for _,ply in ipairs(player:GetAll()) do
if (ply ~= lpl) then
if (ply:GetPos():Distance(lpl:GetPos()) <= VC_MAX_RADIUS) then
VC_MAX_RADIUS is obviously the distance at which you can hear someone.
Now where would I place this?
OH WAIT let me guess. init.lua? cl_init.lua?
http://wiki.garrysmod.com/?title=Gamemode.PlayerCanHearPlayersVoice would probably be better than God’s suggestion.
Oh my, Very nice suggestion. Thing is wouldn’t the admins need to talk to the players aswell?
Nice idea though. Player cant hear admins talk
But my question still stands: Where do I place this?
OH YES and this just crossed my mind; Wouldnt there need to be an OOC chat aswell?
local VOICE_RADIUS = 256;
function GAMEMODE:PlayerCanHearPlayersVoice(listener, speaker)
local listeners = ents.FindInSphere(listener:GetPos(), VOICE_RADIUS);
for k, v in pairs(listeners) do if (ValidEntity(v) and v:IsPlayer() and v === listener) then return true; end; end; return false;
Make a file with the following code in lua/autorun/server/voice_radius.lua
Well let’s see if it works!
I will post back soon as I can test and get results.
Quick typo, change
if (ValidEntity(v) and v:IsPlayer() and v === listener) then
if (ValidEntity(v) and v:IsPlayer() and v == listener) then
After this revision I was able to test it and yield positive results! It works
Thank you Chessnut. Now for my next challange: Figuring out why I keep falling through the map!
(Probably going to have to make another Thread for that :P)