From 13d8f50df960e864aea4439681b1695969732967 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Mon, 19 Aug 2019 18:39:04 -0700 Subject: [PATCH] Disconnected player entities will now disappear, fixed 'kill' command --- Source/server/scihunt/client.c | 19 ++++++++++++++----- Source/server/valve/client.c | 23 +++++++++++++++++++++-- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/Source/server/scihunt/client.c b/Source/server/scihunt/client.c index f53a52e9..395b216a 100644 --- a/Source/server/scihunt/client.c +++ b/Source/server/scihunt/client.c @@ -12,15 +12,24 @@ void Game_ClientConnect(void) { bprint(PRINT_HIGH, sprintf("%s connected\n", self.netname)); } + void Game_ClientDisconnect(void) { - bprint(PRINT_HIGH, sprintf("%s disconnected\n", self.netname)); -} -void Game_ClientKill(void) -{ - + bprint(PRINT_HIGH, sprintf("%s disconnected\n", self.netname)); + + /* Make this unusable */ + self.solid = SOLID_NOT; + self.movetype = MOVETYPE_NONE; + self.modelindex = 0; + self.health = 0; + self.takedamage = 0; + self.SendFlags = 1; } +void Game_ClientKill(void) +{ + Damage_Apply(self, self, self.health, self.origin, TRUE); +} void Game_PlayerPreThink(void) { diff --git a/Source/server/valve/client.c b/Source/server/valve/client.c index 1f634ac2..49570bd8 100644 --- a/Source/server/valve/client.c +++ b/Source/server/valve/client.c @@ -16,11 +16,19 @@ void Game_ClientConnect(void) void Game_ClientDisconnect(void) { bprint(PRINT_HIGH, sprintf("%s disconnected\n", self.netname)); + + /* Make this unusable */ + self.solid = SOLID_NOT; + self.movetype = MOVETYPE_NONE; + self.modelindex = 0; + self.health = 0; + self.takedamage = 0; + self.SendFlags = 1; } void Game_ClientKill(void) { - + Damage_Apply(self, self, self.health, self.origin, TRUE); } void Game_PlayerPreThink(void) @@ -86,7 +94,18 @@ void Game_PutClientInServer(void) pl.movetype = MOVETYPE_WALK; pl.flags = FL_CLIENT; pl.viewzoom = 1.0; - setmodel(pl, "models/player.mdl"); + pl.model = "models/player.mdl"; + + string mymodel = infokey(pl, "model"); + + if (mymodel) { + mymodel = sprintf("models/player/%s/%s.mdl", mymodel, mymodel); + if (whichpack(mymodel)) { + pl.model = mymodel; + } + } + setmodel(pl, pl.model); + setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX); pl.view_ofs = VEC_PLAYER_VIEWPOS; pl.velocity = [0,0,0];