From 7cad0b6281a3795b75652c73f2f82007c52371b5 Mon Sep 17 00:00:00 2001 From: Richard Helgeby Date: Sun, 26 Feb 2012 15:39:12 +0100 Subject: [PATCH] Fixed ragdolls being removed in spawn event when removal is disabled. --- src/zr/respawn.inc | 7 +++++++ src/zr/visualeffects/ragdoll.inc | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/src/zr/respawn.inc b/src/zr/respawn.inc index 3aaba30..44fa281 100644 --- a/src/zr/respawn.inc +++ b/src/zr/respawn.inc @@ -174,6 +174,13 @@ bool:RespawnSpawnClient(client, bool:zombie = false, bool:zombieIfSuicide = fals // Restore respawn condition. RespawnRestoreCondition(condition, zombie, zombieIfSuicide); + new bool:ragdollremove = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_RAGDOLL_REMOVE]); + if (!ragdollremove) + { + // Detatch ragdoll so it's not removed on respawn. + RagdollResetClientRagdoll(client); + } + // Spawn player. CS_RespawnPlayer(client); diff --git a/src/zr/visualeffects/ragdoll.inc b/src/zr/visualeffects/ragdoll.inc index 1acde50..e3cc261 100644 --- a/src/zr/visualeffects/ragdoll.inc +++ b/src/zr/visualeffects/ragdoll.inc @@ -179,3 +179,12 @@ RagdollGetClientRagdoll(client) { return GetEntDataEnt2(client, g_iToolsRagdoll); } + +/** + * Removes the ragdoll entity of a client. + * @param client The client index. + */ +RagdollResetClientRagdoll(client) +{ + SetEntDataEnt2(client, g_iToolsRagdoll, -1); +}