Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if not engine.IsPlayingDemo() then return end
- talkingPlayers = {}
- function OnVoiceStarted( ply )
- if not table.HasValue( talkingPlayers, ply:Name()) then
- table.insert( talkingPlayers, ply:Name() )
- end
- --PrintTable( talkingPlayers )
- end
- function OnVoiceEnd( ply )
- if vgui.GetWorldPanel():Find( ply:Name() ) != nil then
- vgui.GetWorldPanel():Find( ply:Name() ):Remove()
- end
- table.RemoveByValue( talkingPlayers, ply:Name())
- end
- function getProfilePicture( ply )
- if vgui.GetWorldPanel():Find( ply:Name() ) != nil then
- return vgui.GetWorldPanel():Find( ply:Name() )
- end
- return nil
- end
- function removeProfilePicture( ply )
- if vgui.GetWorldPanel():Find( ply:Name() ) != nil then
- vgui.GetWorldPanel():Find( ply:Name() ):Remove()
- end
- end
- function getPlayerByName( name )
- for k,v in pairs( player.GetAll() ) do
- if name == v:Name() then
- return v
- end
- end
- return nil
- end
- hook.Add( "PlayerStartVoice", "OnVoiceStarted", function(ply)
- OnVoiceStarted( ply )
- end)
- hook.Add( "PlayerEndVoice", "OnVoiceEnd", function(ply)
- OnVoiceEnd( ply )
- end)
- hook.Add( "HUDPaint", "DrawVoiceBoxes", function()
- if #talkingPlayers != 0 then
- local baseW = ScrW()-310
- --local baseH = (ScrH()/2)+385
- --above does not work on lower resolutions.
- local baseH = (ScrH()/2)+250 -- confirmed working on everything above 800x600.
- local hIncrement = 0
- for i,name in ipairs( talkingPlayers ) do
- local ply = getPlayerByName( name )
- local profilepicture = getProfilePicture( ply )
- if profilepicture == nil then
- profilepicture = vgui.Create( "AvatarImage", self, ply:Name())
- profilepicture:SetSize( 32, 32 )
- profilepicture:SetPos( baseW+4, (baseH+4)-hIncrement )
- profilepicture:SetPlayer( ply, 32 )
- else
- profilepicture:SetPos( baseW+4, (baseH+4)-hIncrement )
- end
- draw.RoundedBox( 4, baseW, baseH-hIncrement, 246, 40, Color( 0, ply:VoiceVolume() * 255, 0, 240 ) )
- draw.DrawText( talkingPlayers[i], "GModNotify", baseW+45, (baseH+10)-hIncrement, Color( 255, 255, 255, 255 ), 0 )
- hIncrement = hIncrement + 45
- end
- end
- end)
- print( "==============================================================" )
- print( "GMod Demo Voice Fix Script Loaded " )
- print( "Version: 1.1 " )
- print( "Created by youtube.com/videooven " )
- print( "Edited by Sticky Bandit " )
- print( "==============================================================" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement