Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. local meta = FindMetaTable("Player")
  2.  
  3. function meta:getRadio()
  4. if !(self.nextRadioScan) then self.nextRadioScan = 0 end
  5. if !(self.radioFreq) then self.radioFreq = nil end
  6. if self.nextRadioScan <= CurTime() then
  7. local char = self:getChar()
  8. local inv = char:getInv():getItems()
  9.  
  10. if char then
  11. local freq = nil
  12.  
  13. for id,item in pairs(inv) do
  14. if item.uniqueID == "radio" and item:getData("power", false) == true then
  15. freq = item:getData("freq", "000.0")
  16. break
  17. end
  18. end
  19. self.radioFreq = freq
  20. end
  21. self.nextRadioScan = CurTime() + 5
  22. return self.radioFreq
  23. else
  24. return self.radioFreq
  25. end
  26. end
  27.  
  28. hook.Add( "PlayerCanHearPlayersVoice", "dsftgjhdfghjfdghjfghj", function( ply, spk )
  29. local key = IN_WALK
  30. if spk:InVehicle() then
  31. key = IN_DUCK
  32. end
  33. local freq = spk:getRadio()
  34. local freq2 = ply:getRadio()
  35.  
  36. if freq then
  37. if freq2 then
  38. if freq == freq2 then
  39. if spk:KeyDown(key) then
  40. return true
  41. end
  42. end
  43. end
  44. end
  45. end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement