From 68c2cf2e0cfa90088b407ef1af072b495bfe5760 Mon Sep 17 00:00:00 2001 From: AlmTech Date: Sat, 14 Sep 2019 17:11:56 +0200 Subject: [PATCH] Tweaked networking stuff --- gamemode/engine/core/server/sv_player_init.lua | 6 ++++-- gamemode/engine/derma/cl_character.lua | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gamemode/engine/core/server/sv_player_init.lua b/gamemode/engine/core/server/sv_player_init.lua index 4f755a8..e89377f 100644 --- a/gamemode/engine/core/server/sv_player_init.lua +++ b/gamemode/engine/core/server/sv_player_init.lua @@ -16,6 +16,8 @@ end local function setUpPlayer( ply ) + Quantum.Server.Char.SetCurrentCharacter( ply, ply.charindex || 1 ) + if( ply:GetModel() ~= nil ) then ply:SetupHands() else @@ -26,8 +28,8 @@ end function GM:PlayerSpawn( ply ) - if( !ply.isloaded ) then - ply:Spectate( OBS_MODE_CHASE ) + if( ply.isloaded ) then + ply:Spectate( OBS_MODE_FIXED ) else setUpPlayer( ply ) end diff --git a/gamemode/engine/derma/cl_character.lua b/gamemode/engine/derma/cl_character.lua index df86298..c4ad9d4 100644 --- a/gamemode/engine/derma/cl_character.lua +++ b/gamemode/engine/derma/cl_character.lua @@ -9,7 +9,22 @@ local function char_derma() local sw, sh = ScrW(), ScrH() if( !f ) then local f = vgui.Create( "DFrame" ) - f:SetTitle( "Character Derma" ) + f:SetTitle( "Character Menu" ) f:SetSize( sw, sh ) + + local txt = vgui.Create( "DTextEntry" ) + txt:SetText( "Enter name here" ) + txt:SizeToContents() + txt:SetPos( 100, 100 ) + + local b = vgui.Create( "DButton" ) + b:SetText( "Create char" ) + b:SizeToContents() + b.DoClick = function() + net.Start( "quantum_menu_button_net" ) + net.WriteString( "createchar" ) + net.WriteTable( { name = txt:GetValue() } ) + net.SendToServer() + end end end \ No newline at end of file