From d15cc3163c32b74bdb9ab6947ea02a1d4b2c83d2 Mon Sep 17 00:00:00 2001 From: AlmTech Software Date: Fri, 29 Nov 2019 21:06:51 +0100 Subject: [PATCH] Fixed player spawning when changing character --- gamemode/engine/core/server/sv_player_spawning.lua | 3 +++ gamemode/engine/core/sh_player_binds.lua | 3 +-- gamemode/engine/lib/server/sv_character.lua | 1 + gamemode/settings/sv_settings.lua | 5 +++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gamemode/engine/core/server/sv_player_spawning.lua b/gamemode/engine/core/server/sv_player_spawning.lua index cec01ee..5cf68ed 100644 --- a/gamemode/engine/core/server/sv_player_spawning.lua +++ b/gamemode/engine/core/server/sv_player_spawning.lua @@ -40,5 +40,8 @@ hook.Add( "PlayerSpawn", "Quantum_Player_Respawn", function( pl ) Quantum.Debug( "Respawning player at nearest spawnpoint." ) pl:SetPos( spawnpos ) pl:SetAngles( spawnangle ) + elseif( pl.isloaded ) then + pl:SetPos( Quantum.Server.Settings.InitSpawnLocation.pos ) + pl:SetAngles( Quantum.Server.Settings.InitSpawnLocation.ang ) end end) \ No newline at end of file diff --git a/gamemode/engine/core/sh_player_binds.lua b/gamemode/engine/core/sh_player_binds.lua index 796978f..0c29447 100644 --- a/gamemode/engine/core/sh_player_binds.lua +++ b/gamemode/engine/core/sh_player_binds.lua @@ -23,8 +23,7 @@ if SERVER then function GM:KeyRelease( ply, key ) if( keyfuncs[key] ) then keyfuncs[key]( ply ) end end - function GM:ShowHelp( ply ) keyfuncs["openCharMenu"]( ply ) end - function GM:ShowTeam( ply ) keyfuncs["mainMenu"]( ply ) end + function GM:ShowHelp( ply ) keyfuncs["mainMenu"]( ply ) end function GM:ShowSpare2( ply ) keyfuncs["intro"]( ply ) end end \ No newline at end of file diff --git a/gamemode/engine/lib/server/sv_character.lua b/gamemode/engine/lib/server/sv_character.lua index a9bf6ab..b85138d 100644 --- a/gamemode/engine/lib/server/sv_character.lua +++ b/gamemode/engine/lib/server/sv_character.lua @@ -60,6 +60,7 @@ end local function setupCharacter( pl, char ) pl.isloaded = true + pl.deathpos = nil pl:Spawn() pl:SetMaxHealth( char.maxhealth ) pl:SetHealth( char.health ) diff --git a/gamemode/settings/sv_settings.lua b/gamemode/settings/sv_settings.lua index 802fc4d..d253339 100644 --- a/gamemode/settings/sv_settings.lua +++ b/gamemode/settings/sv_settings.lua @@ -18,6 +18,11 @@ Quantum.Server.Settings.Inventory = { Width = 5 } +Quantum.Server.Settings.InitSpawnLocation = { + pos = Vector( 5054.682617, 3152.809326, 168.031250 ), + ang = Angle( 3.009660, 89.639153, 0.000000 ) +} + Quantum.Server.Settings.SpawnLocations = { ["rp_truenorth_v1a_livin"] = {