Created
April 9, 2021 06:04
-
-
Save wickedplayer494/bdbc27c29b3d1f23781521e5c08e9789 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = 27 | |
local baseH = 27 | |
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+5, (baseH+5)-hIncrement ) | |
profilepicture:SetPlayer( ply, 32 ) | |
else | |
profilepicture:SetPos( baseW+4, (baseH+4)-hIncrement ) | |
end | |
if ply:Alive() then | |
draw.RoundedBox( 4, baseW, baseH-hIncrement, 196, 40, Color( 0, 200, 0, 255 ) ) | |
draw.RoundedBox( 4, baseW+1, baseH-hIncrement+1, 194, 38, Color( 0, 134, 0, 255 ) ) | |
draw.DrawText( talkingPlayers[i], "GModNotify", baseW+44, (baseH+9)-hIncrement, Color( 255, 255, 255, 255 ), 0 ) | |
hIncrement = hIncrement - 45 | |
else | |
draw.RoundedBox( 4, baseW, baseH-hIncrement, 196, 40, Color( 200, 200, 0, 255 ) ) | |
draw.RoundedBox( 4, baseW+1, baseH-hIncrement+1, 194, 38, Color( 134, 134, 0, 255 ) ) | |
draw.DrawText( talkingPlayers[i], "GModNotify", baseW+44, (baseH+9)-hIncrement, Color( 255, 255, 255, 255 ), 0 ) | |
hIncrement = hIncrement - 45 | |
end | |
end | |
end | |
end) | |
print( "==============================================================" ) | |
print( "GMod Demo Voice Fix Script Loaded " ) | |
print( "Version: 1.2 " ) | |
print( "Created by youtube.com/videooven " ) | |
print( "1.1 Edited by Sticky Bandit, 1.2 Edited by wickedplayer494 " ) | |
print( "==============================================================" ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment