- Initiateur de la discussion
Quentin Litoria
Geek suprême
- Messages
- 64
- Score réaction
- 7
- Points
- 105
Bonjour,
Je cherche à transformer le nom de la personne qui parle quand elle porte un masque en anonyme (nom du cl_voice en bas a droite quand quelqu'un parle) avec ceci
Voice le cl_voice de base
Je vous remercie d'avance pour votre aide, Cordialement Quentin Litoria
Je cherche à transformer le nom de la personne qui parle quand elle porte un masque en anonyme (nom du cl_voice en bas a droite quand quelqu'un parle) avec ceci
if self:getDevBool( "aunmasque", true) then
. Mais quand je met ceci et je remplace les ply:Nick() et que la personne porte son masque, celle ci voit tout les gens parler en anonyme mais pas celui qui l'entend parler alors que je veut l'inverse.Voice le cl_voice de base
cl_voice:
local PANEL = {}
local PlayerVoicePanels = {}
function PANEL:Init() self.LabelName = vgui.Create( "DLabel", self ) self.LabelName:SetFont( "GModNotify" ) self.LabelName:Dock( FILL ) self.LabelName:DockMargin( 8, 0, 0, 0 ) self.LabelName:SetTextColor( Color( 255, 255, 255, 255 ) ) self.Avatar = vgui.Create( "AvatarImage", self ) self.Avatar:Dock( LEFT ) self.Avatar:SetSize( 32, 32 ) self.Color = color_transparent self:SetSize( 250, 32 + 8 ) self:DockPadding( 4, 4, 4, 4 ) self:DockMargin( 2, 2, 2, 2 ) self:Dock( BOTTOM )
end
function PANEL:Setup( ply ) self.ply = ply self.Avatar:SetPlayer( ply ) self.Color = team.GetColor( ply:Team() ) self:InvalidateLayout() self.LabelName:SetText( ply:Nick() )
end
function PANEL:Paint( w, h ) if ( !IsValid( self.ply ) ) then return end draw.RoundedBox( 4, 0, 0, w, h, Color( 0, self.ply:VoiceVolume() * 255, 0, 240 ) )
end
function PANEL:Think() if ( IsValid( self.ply ) ) then self.LabelName:SetText( self.ply:Nick() ) end if ( self.fadeAnim ) then self.fadeAnim:Run() end
end
function PANEL:FadeOut( anim, delta, data ) if ( anim.Finished ) then if ( IsValid( PlayerVoicePanels[ self.ply ] ) ) then PlayerVoicePanels[ self.ply ]:Remove() PlayerVoicePanels[ self.ply ] = nil return end return end self:SetAlpha( 255 - ( 255 * delta ) )
end
derma.DefineControl( "VoiceNotify", "", PANEL, "DPanel" )
function GM:PlayerStartVoice( ply ) if ( !IsValid( g_VoicePanelList ) ) then return end -- There'd be an exta one if voice_loopback is on, so remove it. GAMEMODE:PlayerEndVoice( ply ) if ( IsValid( PlayerVoicePanels[ ply ] ) ) then if ( PlayerVoicePanels[ ply ].fadeAnim ) then PlayerVoicePanels[ ply ].fadeAnim:Stop() PlayerVoicePanels[ ply ].fadeAnim = nil end PlayerVoicePanels[ ply ]:SetAlpha( 255 ) return end if ( !IsValid( ply ) ) then return end local pnl = g_VoicePanelList:Add( "VoiceNotify" ) pnl:Setup( ply ) PlayerVoicePanels[ ply ] = pnl
end
local function VoiceClean() for k, v in pairs( PlayerVoicePanels ) do if ( !IsValid( k ) ) then GAMEMODE:PlayerEndVoice( k ) end end
end
timer.Create( "VoiceClean", 10, 0, VoiceClean )
function GM:PlayerEndVoice( ply ) if ( IsValid( PlayerVoicePanels[ ply ] ) ) then if ( PlayerVoicePanels[ ply ].fadeAnim ) then return end PlayerVoicePanels[ ply ].fadeAnim = Derma_Anim( "FadeOut", PlayerVoicePanels[ ply ], PlayerVoicePanels[ ply ].FadeOut ) PlayerVoicePanels[ ply ].fadeAnim:Start( 2 ) end
end
local function CreateVoiceVGUI() g_VoicePanelList = vgui.Create( "DPanel" ) g_VoicePanelList:ParentToHUD() g_VoicePanelList:SetPos( ScrW() - 300, 100 ) g_VoicePanelList:SetSize( 250, ScrH() - 200 ) g_VoicePanelList:SetPaintBackground( false )
end
hook.Add( "InitPostEntity", "CreateVoiceVGUI", CreateVoiceVGUI )
Je vous remercie d'avance pour votre aide, Cordialement Quentin Litoria