
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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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