reset hp on restart #1187

Co-authored-by: rtldg <rtldg@protonmail.com>
This commit is contained in:
xhaooy 2023-02-26 05:47:48 +00:00 committed by rtldg
parent 830ebc1b73
commit 9eceb51ea6

View File

@ -114,6 +114,7 @@ Convar gCV_RestrictNoclip = null;
Convar gCV_SpecScoreboardOrder = null; Convar gCV_SpecScoreboardOrder = null;
Convar gCV_BadSetLocalAnglesFix = null; Convar gCV_BadSetLocalAnglesFix = null;
ConVar gCV_PauseMovement = null; ConVar gCV_PauseMovement = null;
Convar gCV_RestartWithFullHP = null;
// external cvars // external cvars
ConVar sv_cheats = null; ConVar sv_cheats = null;
@ -293,6 +294,11 @@ public void OnPluginStart()
gCV_RestrictNoclip = new Convar("shavit_misc_restrictnoclip", "0", "Should noclip be be restricted\n0 - Disabled\n1 - No vertical velocity while in noclip in start zone\n2 - No noclip in start zone", 0, true, 0.0, true, 2.0); gCV_RestrictNoclip = new Convar("shavit_misc_restrictnoclip", "0", "Should noclip be be restricted\n0 - Disabled\n1 - No vertical velocity while in noclip in start zone\n2 - No noclip in start zone", 0, true, 0.0, true, 2.0);
gCV_SpecScoreboardOrder = new Convar("shavit_misc_spec_scoreboard_order", "1", "Use scoreboard ordering for players when changing target when spectating.", 0, true, 0.0, true, 1.0); gCV_SpecScoreboardOrder = new Convar("shavit_misc_spec_scoreboard_order", "1", "Use scoreboard ordering for players when changing target when spectating.", 0, true, 0.0, true, 1.0);
if (gEV_Type != Engine_TF2)
{
gCV_RestartWithFullHP = new Convar("shavit_misc_restart_with_full_hp", "1", "Reset hp on restart?", 0, true, 0.0, true, 1.0);
}
if (gEV_Type != Engine_CSGO) if (gEV_Type != Engine_CSGO)
{ {
gCV_BadSetLocalAnglesFix = new Convar("shavit_misc_bad_setlocalangles_fix", "1", "Fix 'Bad SetLocalAngles' on func_rotating entities.", 0, true, 0.0, true, 1.0); gCV_BadSetLocalAnglesFix = new Convar("shavit_misc_bad_setlocalangles_fix", "1", "Fix 'Bad SetLocalAngles' on func_rotating entities.", 0, true, 0.0, true, 1.0);
@ -2282,6 +2288,13 @@ public void Shavit_OnRestart(int client, int track)
if(gEV_Type != Engine_TF2) if(gEV_Type != Engine_TF2)
{ {
SetEntPropFloat(client, Prop_Send, "m_flStamina", 0.0); SetEntPropFloat(client, Prop_Send, "m_flStamina", 0.0);
if (gCV_RestartWithFullHP.BoolValue)
{
SetEntityHealth(client, 100);
SetEntProp(client, Prop_Send, "m_ArmorValue", 100);
SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
}
} }
} }