1. Post #1
    InfernalCookie's Avatar
    December 2010
    700 Posts
    What is the easiest way to make a 2-Way Chat using Derma? What I mean is make a Frame and inside the frame set up 2 TextEntry's. One will be uneditable and hold all the chat and the other you type the message into.

    What would the easiest way to send what one player says to the other player?

  2. Post #2
    JustSoFaded's Avatar
    December 2011
    432 Posts
    client -> server -> client

    step 1. make a server sided concommand that takes the sent message as an arg
    step 2. client side make your GUI and on the .OnEnter function on your panel run the command with the textbox text
    step 3. make concommand also send text to opposite client
    step 4. on each client, when an incoming message is found just do

    dtextbox:SetText( dtextbox:GetValue().."\n"..msg );
    

  3. Post #3
    InfernalCookie's Avatar
    December 2010
    700 Posts
    Do you mind helping me out here? It seems everything works other than the PLUGIN:ShowReport() function .. It just doesn't show the derma (Haven't set up the sending messages part)

    local PLUGIN = {}
    PLUGIN.Title = "NReport"
    PLUGIN.Description = "Report a player."
    PLUGIN.Author = ""
    PLUGIN.ChatCommand = "nreport"
    PLUGIN.Usage = '<player> <string of reasons>'
    PLUGIN.Privileges = { "NReport" }
    
    
    function PLUGIN:Call( ply, args )
    	if ( ply:EV_HasPrivilege( "NReport" ) ) then
    		targetpl = evolve:FindPlayer( args[1] )
    		if #targetpl > 1 then
    			
    		elseif #targetpl == 0 then
    		
    		elseif #targetpl == 1 then
    			targetpl = targetpl[1]
    			
    			for k,v in pairs( player.GetAll() ) do
    				if !v:IsUserGroup( "guest" ) and !v:IsUserGroup( "member" ) and !v:IsUserGroup( "vip" ) and !v:IsUserGroup( "trusted" ) then
    					SendUserMessage( "EV_AlarmAdmins", v, targetpl:Nick(), ply:Nick() )
    					evolve:Notify( v, evolve.colors.blue, ply:Nick(), evolve.colors.red, " has reported ", evolve.colors.blue, targetpl:Nick(), evolve.colors.red, "." )
    				end
    			end
    		end
    	else
    		evolve:Notify( ply, evolve.colors.red, evolve.constants.notallowed )
    	end
    end
    
    --if ( SERVER ) then
    function PLUGIN:ClaimReport( ply, args )
    	local target = evolve:FindPlayer( args[1] )
    	local target = target[1]
    	for k,v in pairs( player.GetAll() ) do
    		if !v:IsUserGroup( "guest" ) and !v:IsUserGroup( "member" ) and !v:IsUserGroup( "vip" ) and !v:IsUserGroup( "trusted" ) then
    			if SERVER then SendUserMessage( "EV_CloseAlarm", v ) end
    			evolve:Notify( v, evolve.colors.blue, ply:Nick(), evolve.colors.red, " has claimed the report on ", evolve.colors.blue, target:Nick(), evolve.colors.red, "." )
    		end
    	end
    	print( Format( "[EV] %s has claimed the report on %s.", ply:Nick(), target:Nick() ) )
    end
    concommand.Add( "EV_ClaimReport", function( ply, cmd, args ) PLUGIN:ClaimReport( ply, args ) end )
    
    function PLUGIN:StartReportChat( ply, args )
    	local target = evolve:FindPlayer( args[1] )
    	local target = target[1]
    	if SERVER then SendUserMessage( "StartReportChat", target ) end
    	if SERVER then SendUserMessage( "StartReportChat", ply ) end
    end
    concommand.Add( "EV_StartReportChat", function( ply, cmd, args ) PLUGIN:StartReportChat( ply, args ) end )
    --end
    
    if ( CLIENT ) then
    	function PLUGIN:AlarmAdmins( ply, reporter )	
    		self.AlarmWindow = vgui.Create( "DFrame" )
    		self.AlarmWindow:SetSize( 100, 100 )
    		self.AlarmWindow:SetPos( ScrW() - self.AlarmWindow:GetWide() - 5, ScrH() - self.AlarmWindow:GetTall() - 5 )
    		self.AlarmWindow:SetTitle( "Report" )
    		self.AlarmWindow:SetDraggable( false )
    		self.AlarmWindow:ShowCloseButton( true )
    		self.AlarmWindow:SetMouseInputEnabled(false)
    		self.AlarmWindow:SetBackgroundBlur( false )
    		self.AlarmWindow:MakePopup()
    		
    		self.AlarmButton = vgui.Create( "DImageButton", self.AlarmWindow )
    		self.AlarmButton:SetSize( 60, 60 )
    		self.AlarmButton:SetPos( 20,30 )
    		self.AlarmButton:SetImage( "gui/silkicons/exclamation.vtf" )
    		self.AlarmButton.DoClick = function()
    			self.AlarmWindow:SetVisible( false )
    			RunConsoleCommand( "EV_ClaimReport", ply )
    			RunConsoleCommand( "EV_StartReportChat", ply, reporter )
    			--ShowReport( ply, reason, reporter )
    		end
    	end
    	usermessage.Hook( "EV_AlarmAdmins", function( um ) PLUGIN:AlarmAdmins( um:ReadString(), um:ReadString() ) end )
    	usermessage.Hook( "EV_CloseAlarm", function( um ) PLUGIN.AlarmWindow:SetVisible( false ) end )
    	
    	function PLUGIN:ShowReport( )
    		local ply = LocalPlayer()
    		ply.ReportFrame = vgui.Create( "DFrame" )
    		ply.ReportFrame:SetSize( 250, 600 )
    		ply.ReportFrame:SetPos( ScrW() - ply.ReportFrame:GetWide() - 5, ScrH() - ply.ReportFrame:GetTall() - 5 )
    		ply.ReportFrame:SetTitle( "" )
    		ply.ReportFrame:SetDraggable( false )
    		ply.ReportFrame:ShowCloseButton( true )
    		ply.ReportFrame:MakePopup()
    		
    		ply.ReportEntry = vgui.Create( "DTextEntry", ply.ReportFrame )
    		ply.ReportEntry:SetSize( 240, 525 )
    		ply.ReportEntry:SetPos( 5, 25 )
    		ply.ReportEntry:SetEditable( false )
    		ply.ReportEntry:SetValue( "" )
    		ply.ReportEntry:SetEnterAllowed( false )
    		
    		ply.ReportEntry2 = vgui.Create( "DTextEntry", ply.ReportFrame )
    		ply.ReportEntry2:SetSize( 240, 20 )
    		ply.ReportEntry2:SetPos( 5, 530 )
    		ply.ReportEntry2:SetEditable( true )
    		ply.ReportEntry2:SetValue( "" )
    		ply.ReportEntry2:SetEnterAllowed( true )
    		ply.ReportEntry2.OnEnter = function()
    			
    		end
    		
    	end
    	usermessage.Hook( "StartReportChat", function( um ) PLUGIN:ShowReport() end )
    end
    
    evolve:RegisterPlugin( PLUGIN )
    

  4. Post #4
    InfernalCookie's Avatar
    December 2010
    700 Posts
    Bump D:

  5. Post #5
    InfernalCookie's Avatar
    December 2010
    700 Posts
    bump again