Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local meta = FindMetaTable("Player")
- function meta:getRadio()
- if !(self.nextRadioScan) then self.nextRadioScan = 0 end
- if !(self.radioFreq) then self.radioFreq = nil end
- if self.nextRadioScan <= CurTime() then
- local char = self:getChar()
- local inv = char:getInv():getItems()
- if char then
- local freq = nil
- for id,item in pairs(inv) do
- if item.uniqueID == "radio" and item:getData("power", false) == true then
- freq = item:getData("freq", "000.0")
- break
- end
- end
- self.radioFreq = freq
- end
- self.nextRadioScan = CurTime() + 5
- return self.radioFreq
- else
- return self.radioFreq
- end
- end
- hook.Add( "PlayerCanHearPlayersVoice", "dsftgjhdfghjfdghjfghj", function( ply, spk )
- local key = IN_WALK
- if spk:InVehicle() then
- key = IN_DUCK
- end
- local freq = spk:getRadio()
- local freq2 = ply:getRadio()
- if freq then
- if freq2 then
- if freq == freq2 then
- if spk:KeyDown(key) then
- return true
- end
- end
- end
- end
- end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement