From 925e6036103245063eba23a8b53010775cf5d8d9 Mon Sep 17 00:00:00 2001 From: AlmTech Date: Sat, 28 Sep 2019 15:59:44 +0200 Subject: [PATCH] Fixed the SNM api --- gamemode/engine/core/server/sv_player_init.lua | 7 ++----- gamemode/engine/derma/lib/cl_network.lua | 6 +++--- gamemode/engine/derma/menus/menu_character.lua | 8 ++++++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/gamemode/engine/core/server/sv_player_init.lua b/gamemode/engine/core/server/sv_player_init.lua index fcd20d8..ffd7afb 100644 --- a/gamemode/engine/core/server/sv_player_init.lua +++ b/gamemode/engine/core/server/sv_player_init.lua @@ -11,7 +11,7 @@ local ply = FindMetaTable( "Player" ) function GM:PlayerInitialSpawn( ply ) --ply.isloaded = true -- REMOVE THIS WHEN MYSQL DB IS ADDED - + -- load in all of the players characters and stuff from the MySQL DB end local function setUpPlayer( ply ) @@ -31,10 +31,7 @@ function GM:PlayerSpawn( ply ) if( !ply.isloaded ) then ply:Spectate( OBS_MODE_FIXED ) else - if( !ply:Alive()) then - ply:UnSpectate() - ply:Spawn() - end + ply:UnSpectate() setUpPlayer( ply ) end diff --git a/gamemode/engine/derma/lib/cl_network.lua b/gamemode/engine/derma/lib/cl_network.lua index e1d5165..0a1ec33 100644 --- a/gamemode/engine/derma/lib/cl_network.lua +++ b/gamemode/engine/derma/lib/cl_network.lua @@ -5,13 +5,13 @@ -- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -local net = {} +local snm = {} -- Safe. Networked. Message -function net.RunNetworkedFunc( func, args ) +function snm.RunNetworkedFunc( func, args ) net.Start( "quantum_menu_button_net" ) -- used for menu buttons etc net.WriteString( func ) -- don't worry! it's very secure :D net.WriteTable( args ) net.SendToServer() end -return net \ No newline at end of file +return snm \ No newline at end of file diff --git a/gamemode/engine/derma/menus/menu_character.lua b/gamemode/engine/derma/menus/menu_character.lua index 0e9a649..def1b51 100644 --- a/gamemode/engine/derma/menus/menu_character.lua +++ b/gamemode/engine/derma/menus/menu_character.lua @@ -19,12 +19,16 @@ function menu.open( dt ) local txt = vgui.Create( "DTextEntry", f ) txt:SetText( "Enter name here" ) - txt:SizeToContents() - txt:SetPos( 100, 100 ) + txt:SetSize( 250, 25 ) + local txtW, txtH = txt:GetSize() + txt:SetPos( sw/2 - txtW/2, sh/2 - txtH/2 ) + local txtX, txtY = txt:GetPos() local b = vgui.Create( "DButton", f ) b:SetText( "Create Char" ) b:SizeToContents() + local bW, bH = b:GetSize() + b:SetPos( sw/2 - bW/2, txtY - bH ) b.DoClick = function() net.RunNetworkedFunc( "createChar", { name = txt:GetValue() } ) end