Hey dear readers,
im new to this board and need some help.
Im currently working on a Derma where i can select Players from a List.
I want when im holding the +voicerecord button able to talk to the one whom i selected.
Gamemode: DarkRP
Code: (Just a snippet)
function GetNameToPlayer( ply, target )
for k,v in pairs( player.GetAll() ) do
if PlayerName == nil then
PlayerName = LocalPlayer():Nick()
end
if v:Nick() == PlayerName then
return v
end
end
end
function PlayerCanHearPlayersVoice( ply, rec )
if LocalPlayer():Alive() and GetNameToPlayer():Alive() then
return true
end
end
hook.Add( "PlayerCanHearPlayersVoice", "PlayerStartedTheirVoiceChat", PlayerCanHearPlayersVoice)
net.Receive("HOLOCOM_OpenMenu", function()
local Base = vgui.Create("DFrame")
Base:SetSize(900,500)
Base:Center()
Base:MakePopup()
Base:SetKeyboardInputEnabled( false )
Base:SetMouseInputEnabled( true )
Base.Paint = function(self, w, h)
surface.SetDrawColor(HOLOCOMConfig.Colors.Orange)
surface.DrawRect(0,0,w,30)
surface.SetDrawColor(HOLOCOMConfig.Colors.LightBlack)
surface.DrawRect(0,30,w,h-30)
draw.SimpleText("Funk Menü","Landung_Font_1",5,3,HOLOCOMConfig.Colors.White,TEXT_ALIGN_LEFT)
draw.SimpleText("Nachricht an:","Landung_Font_3",90,50,HOLOCOMConfig.Colors.White,TEXT_ALIGN_CENTER)
local CamData = {}
local panel_w = 0
local panel_h = -20
local panel_dist = 30
local ang = GetNameToPlayer():EyeAngles() -- this needed the value from the list
local pos = GetNameToPlayer():EyePos() + Vector( 0, 0, panel_h/2 ) + (ang:Forward()*panel_dist) + ang:Right()*-panel_w/2 -- this needed the value from the list
ang:RotateAroundAxis( ang:Up(), 180 )
local x, y = self:GetPos()
CamData.x = x+490
CamData.y = y+45
CamData.w = 390
CamData.h = 400
CamData.origin = pos
CamData.angles = ang
render.RenderView( CamData )
end
local list_view = vgui.Create("DComboBox")
list_view:SetParent(Base)
list_view:SetPos(25, 100)
list_view:SetSize(200, 25)
list_view:SetValue( "Name" )
list_view.OnSelect = function( panel, index, value )
PlayerName = value
end
for k,v in pairs(player.GetAll()) do
local line = list_view:AddChoice(v:Nick())
end
end)
end
Selecting the Player over list_view works but the VoiceHook dont work. Can someone tell me what i need to fix it. (Its like a communication System)
thanks a lot for your help
Thanks alot
Sorry, you need to Log In to post a reply to this thread.