Creating distance local text chat

Hello, I was wondering how I would go creating a local voice chat like in darkrp? Using distances, for my custom gamemode… as local voice chat was easy but how would I do local text chat using OnPlayerChat (client) or would it be PlayerSay (server) sided?

Anyway I appreciate any help!

GM:PlayerCanHearPlayersVoice

[editline]12th October 2017[/editline]

For text chat use

GM:OnPlayerChat and

Vector:Distance

[editline]12th October 2017[/editline]



hook.Add( "OnPlayerChat", "HideMessage", function( ply )
    if LocalPlayer():GetPos():Distance( ply:GetPos() ) < 50 then -- Change 50 to whatever distance you want them to be in
        return true
    end
end )


I checked your steam profile and now I’m just being curious, because you wrote

  1. Why do you ask people about things which were already been made thousands times in the past and you have a source code of at least 1 (darkrp, WOW!) which you can look at and figure out by yourself?
  2. Why do you make a thread for question like that if there is a special one?

That was rude


(User was banned for this post ("Why reply?" - Shendow))

Not all experienced coders know everything, I am new to chat extensions, I have never done it before because it was never in my attention span.

Thanks MPan! :slight_smile: