2007-02-04 01:16:06 +00:00
|
|
|
|
|
|
|
-- phenex: Start radio mod.
|
|
|
|
local radio_channels = {}
|
|
|
|
local radio_sets = {}
|
|
|
|
|
|
|
|
function Radio_Register( o )
|
|
|
|
table.insert( radio_sets, o )
|
|
|
|
end
|
|
|
|
|
2008-02-07 12:58:13 +00:00
|
|
|
function Radio_Transmit(ent,ch,k,v)
|
|
|
|
if (ent.Secure == true) then
|
|
|
|
if (radio_channels[ent.pl:SteamID()] == nil) then radio_channels[ent.pl:SteamID()] = {} end
|
|
|
|
if (radio_channels[ent.pl:SteamID()][ch] == nil) then radio_channels[ent.pl:SteamID()][ch] = {} end
|
|
|
|
radio_channels[ent.pl:SteamID()][ch][k] = v
|
|
|
|
else
|
|
|
|
if (radio_channels[ch] == nil) then radio_channels[ch] = {} end
|
|
|
|
radio_channels[ch][k] = v
|
|
|
|
end
|
2007-02-04 01:16:06 +00:00
|
|
|
|
|
|
|
for i, o in ipairs( radio_sets ) do
|
2007-11-05 21:45:05 +00:00
|
|
|
if (not IsEntity(o.Entity)) then
|
2007-02-04 01:16:06 +00:00
|
|
|
table.remove(radio_sets, i)
|
2008-02-07 12:58:13 +00:00
|
|
|
elseif (o.Channel == ch && o.Entity:EntIndex() != ent:EntIndex()) then
|
|
|
|
if (o.Secure == true && ent.Secure == true) then
|
|
|
|
if (o.pl:EntIndex() == ent.pl:EntIndex()) then
|
|
|
|
o:SReceiveRadio(k,v)
|
|
|
|
end
|
|
|
|
elseif (o.Secure == false && ent.Secure == false) then
|
|
|
|
o:SReceiveRadio(k,v)
|
|
|
|
end
|
2007-02-04 01:16:06 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2008-02-07 12:58:13 +00:00
|
|
|
function Radio_Receive(ent ,ch )
|
|
|
|
if (ent.Secure == true) then
|
|
|
|
if (radio_channels[ent.pl:SteamID()] == nil) then return {} end
|
|
|
|
if (type(radio_channels[ent.pl:SteamID()][ch]) == "table") then
|
|
|
|
return radio_channels[ent.pl:SteamID()][ch] //Nothing fancy needed :P
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if (type(radio_channels[ch]) == "table") then
|
|
|
|
return radio_channels[ch] //Nothing fancy needed :P
|
|
|
|
end
|
2007-11-05 21:45:05 +00:00
|
|
|
end
|
2008-02-07 12:58:13 +00:00
|
|
|
return {}
|
2007-02-04 01:16:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local radio_twowaycounter = 0
|
|
|
|
|
|
|
|
function Radio_GetTwoWayID()
|
|
|
|
radio_twowaycounter = radio_twowaycounter + 1
|
|
|
|
return radio_twowaycounter
|
|
|
|
end
|
|
|
|
|
|
|
|
-- phenex: End radio mod.
|
2008-02-07 12:58:13 +00:00
|
|
|
//Modified by High6 (To support 4 values)
|
|
|
|
//Rebuilt by high6 to allow defined amount of values/secure lines
|