-
Notifications
You must be signed in to change notification settings - Fork 10
/
sv_voice.lua
45 lines (42 loc) · 1.11 KB
/
sv_voice.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
-------------------------------------------------------
----------------RADIO MADE BY PAROW--------------------
-------------------------------------------------------
local voip = {}
RegisterNetEvent('parow:ToggleRadio')
AddEventHandler('parow:ToggleRadio', function(freq,checked)
for i = 1, #voip,1 do
if voip[i].freq == freq then
TriggerClientEvent("parow:mute",source,checked,voip[i].source)
end
end
end)
RegisterNetEvent('parow:SetFreq')
AddEventHandler('parow:SetFreq', function(freq)
local found = true
local k = 0
for i = 1, #voip,1 do
if voip[i].source == source then
found = false
k = i
for p = 1, #voip,1 do
TriggerClientEvent("parow:SyncRadio",voip[p].source,voip,false)
end
break
end
end
if found then
table.insert(voip,{source=source, freq=freq})
else
voip[k].freq = freq
end
for i = 1, #voip,1 do
if voip[i].freq == freq then
TriggerClientEvent("parow:SyncRadio",voip[i].source,voip,true)
end
end
end)
function SyncRadio()
TriggerClientEvent("parow:SyncRadio2",-1,voip)
SetTimeout(5000, SyncRadio)
end
SyncRadio()