Advertisement
Guest User

1

a guest
Feb 22nd, 2020
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. local VoiceIsActived = false
  2.  
  3. function VoiceIcon( x, y, w, h )
  4.  
  5. local Rotating = math.sin(CurTime() * 3)
  6. local backwards = 0
  7.  
  8. if Rotating < 0 then
  9. Rotating = 1 - (1 + Rotating)
  10. backwards = 180
  11. end
  12.  
  13. surface.SetMaterial(Material(MicMod.Icon))
  14. surface.SetDrawColor(color_white )
  15. surface.DrawTexturedRectRotated( x, y, Rotating * 64, 64, backwards )
  16. end
  17.  
  18. hook.Add( "HUDPaint", "MicIcon_HUD", function()
  19.  
  20. if VoiceIsActived then
  21. VoiceIcon( ScrW()-45, ScrH()/2-32, 64, 64)
  22. end
  23. end )
  24.  
  25. --[[***************
  26. ** Get Voice **
  27. ****************]]--
  28.  
  29.  
  30. hook.Add("PlayerStartVoice", "MicIcon_EnableVoice", function(ply)
  31.  
  32. Material("voice/icntlk_pl"):SetFloat("$alpha", 0)
  33.  
  34. if ply == LocalPlayer() then
  35. VoiceIsActived = true
  36. end
  37.  
  38. end)
  39.  
  40. hook.Add("PlayerEndVoice", "MicIcon_DisableVoice", function(ply)
  41.  
  42. if ply == LocalPlayer() then
  43. VoiceIsActived = false
  44. end
  45.  
  46. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement