English Voice chat local

1 reply
Goto Page
To the start Previous 1 Next To the start
26.05.21 02:32:12 pm
Up
_Lima_
User
Offline Off
Look, there is a voice chat, I want to make it local and not on the whole map. But the one who speaks is heard only if all the players are together, even if 1 player has gone far, those who stand close to the one who speaks do not hear him.
How to make players speak separately?
For example, first 2 players stand at one end of the map and hear each other, and second 2 players at the other end of the map hear each other but should not hear the first and vice versa.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function dst_voice(x1,y1,x2,y2)
     return math.floor(math.sqrt(math.pow(x1-x2,2)+math.pow(y1-y2,2)))
end

addhook("voice","voicechat")
function voicechat(id)
if player(id,"exists") and player(id,"health") > 0 then
for _, ID in pairs(player(0,"tableliving")) do
dstc = dst_voice(player(id,'x'),player(id,'y'),player(ID,'x'),player(ID,'y'))
if dstc >= 196 then
return 1
end
end
else
return 1
end
end
S.T.A.L.K.E.R. RP - https://discord.gg/wQUEKSB
26.05.21 03:24:08 pm
Up
It's not possible, the solution would be to have the cs2d lua hook voice give you the receiver ID and have it called for every voice attempt to a player, and that way, you can check it manually.

But that's not a feature, you're free to ask for it, though.
edited 1×, last 26.05.21 04:43:39 pm
fish
To the start Previous 1 Next To the start