Added respawning stuff

master
AlmTech 5 years ago
parent 235ebe75c1
commit cb2c889e6e
  1. 35
      gamemode/core/server/sv_player_spawning.lua
  2. 11
      gamemode/settings/sv_settings.lua

@ -0,0 +1,35 @@
-- __ _ _______ _ __
-- / / /\ | | |__ __| | | \ \
-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \
-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > >
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
hook.Add( "PlayerSpawn", "Quantum_Player_Respawn", function( pl )
if( pl.isloaded && pl.deathpos ) then
local spawnposdist = {}
for id, pos in pairs( Quantum.Server.Settings.SpawnLocations[ game.GetMap() ] ) do
print( id, pos )
spawnposdist[id] = { dist = pos:Distance( pl.deathpos ), spawnpos = pos }
end
local maxdist
local spawnpos
for i, spawnpos in ipairs( spawnposdist ) do -- Loop through everything and pick the nearest spawnpoint
if( maxdist ~= nil ) then
if( maxdist <= spawnpos.dist ) then
maxdist = spawnpos.dist
spawnpos = spawnpos.pos
end
else
maxdist = spawnpos.dist
spawnpos = spawnpos.pos
end
end
Quantum.Debug( "Respawning player at nearest spawnpoint... ( " .. tostring( spawnpos ) .. " )" )
pl:SetPos( spawnpos )
end
end)

@ -9,7 +9,16 @@
Quantum.Server.Settings.VoiceChatRange = 400 Quantum.Server.Settings.VoiceChatRange = 400
Quantum.Server.Settings.DamageScale = { -- The scale of the damage for each hitgroup Quantum.Server.Settings.SpawnLocations = {
["rp_truenorth_v1a_livin"] = {
["Hospital"] = { pos = Vector( 13583, 13189, 128 ), ang = Angle( 1, 115, 0 ) },
["Lake"] = { pos = Vector( 10812, -8319, 5388 ), ang = Angle( 5, -40, 0 ) }
}
}
Quantum.Server.Settings.DamageScale = { -- The scale of the damage for each hitgroup
[HITGROUP_HEAD] = 10, [HITGROUP_HEAD] = 10,
[HITGROUP_CHEST] = 4, [HITGROUP_CHEST] = 4,
[HITGROUP_STOMACH] = 2, [HITGROUP_STOMACH] = 2,

Loading…
Cancel
Save